Scatter objects on the center edges of another and aligned to that also.

   3412   5   1
User Avatar
Member
2 posts
Joined: Sept. 2017
Offline
Hi there,
A newbie here. Nice to meet you all.
I hope you can help me with this one.

Problem:
I have an sphere ( poly ) and in every edge of that sphere I want to scatter a cylinder. Like to perform a wireframe view.
I want it to be scattered and not go for a “wireframe solution” because later I will need to do more things with that scattered cylinder… the final result is to create a Dome Tent. so I will need to add screw and stuff in the edges. etc…


Things I tried:
First I simplified my self the job and started with just a plane. I divide it to get the triangles.
I resampled the plane, so I get points in the middle of every edge but the Copy node, won't read the alignment properly..
I also tried with the carve node.
But I'm kind of stuck, searching/testing for different things with much idea of what I'm doing. hehe.
I've been reading in the forum some people scattering objects on edges of a spline, but this solution didn't work for my case, because I need to remove the points in the connections also, so there won't scatter anything.

Well… is that complicated? am I aiming to high? should I do it by hand this time?
User Avatar
Member
146 posts
Joined: Sept. 2011
Offline
Newb here, too. Pleased to meet you

Not quite clear on why you want to scatter - Scatter op is usually when you want randomness to the points' positions.

One issue you'll have is that in a poly (geodesic) sphere the edges aren't all the same length.

Had a quick play, though; definitely not there yet, but there might be some clues in there. Note the use of Poly Frame, with the Tangent attribute changed to N - this gives you normals that are actually tangential. Also the use of primpoints in the Group Expression to find all the points connected to only 4 others (which happen to be the structure's midpoints)

There are issues (rotation of some of the tubes is wrong) but I ran out of time.

Suspect if you're trying to create a tent you may be best off with a poly wire approach, then add stuff to the points after. (Note the weirdness: to delete all the primitives in a bit of geometry, but leave the points, you need to use the Add SOP. That's Houdini for you

Attachments:
almost.hiplc (71.7 KB)

User Avatar
Member
2 posts
Joined: Feb. 2017
Offline
hello howiem,

Thank you for your approach, while I was waiting for the approval of the message in the forum by the admin, ( It was my very first message ) I tried different things, and you were right. Poly Wire makes much more sense.
my approach of scatter things in the middle of the edges was a pain to control, I'll take a look to your file. at least while trying that way I could learn something. and sure from your file I can learn much more! thanks!

I already trimmed a bit the poly wires, so there is space in the joints. And now I just need to scatter objects in the points so there is the connections.

But! new challenge for me.. there is points with 5 edges and others with 6 edges… now just trying to find a way to scatter one object only if the point has 5 or 6 vertex under it… lets see if I can get far with that.

Thankyou a lot!
User Avatar
Member
146 posts
Joined: Sept. 2011
Offline
But! new challenge for me.. there is points with 5 edges and others with 6 edges… now just trying to find a way to scatter one object only if the point has 5 or 6 vertex under it… lets see if I can get far with that.

Look at the Group by expression SOP in my file: it adds all the points that have 4 connections to them to the group, using the handy pointprims function (which returns an array of any primitives making use of the current point). Change that 4 to a 5. Now you can use that group in a Copy to points SOP to only copy your mesh to one set of points. Duplicate the Copy SOP, stick an exclamation mark in front of the group name - !group1 - to copy only to the points that aren't in the group. Merge the results
Edited by howiem - Jan. 24, 2018 10:39:46
User Avatar
Member
2 posts
Joined: Feb. 2017
Offline
Thankyou!

Thats cool, I'll take a look into that!
User Avatar
Member
18 posts
Joined: Oct. 2017
Offline
Found out in Vex details:

i[]@pts;
int n = 0;

for(n;n<i@toto;n++)
{
    p1 = point(0,"P",n);
    append(@pts,n);
    i[]@nei = neighbours(0,@pts[n]);
    for(int l = 0; l<len(@nei) ; l++)
    {
      p2 = point(0,"P",@nei[l]);
      edge = (p2+p1)/2;
      v[]@arredge;
      push(@arredge, edge);

    }
}

int Count, Count_A;


for(Count = 0; Count < len(@arredge); Count++)
    {
    for(Count_A = 0; Count_A < len(@arredge); Count_A++)
        {
        if( (@arredge[Count] == @arredge[Count_A]) && (Count != Count_A) )
            {
            removeindex(@arredge, Count_A);
            }
        }
    }


for(int v=0; v<len(@arredge); v++)
{    
    addpoint(0, @arredge[v]);
}
  • Quick Links