Connecting points from 2 scatters (0 to 0, 1 to 1, etc) to create lines

   7783   6   0
User Avatar
Member
1007 posts
Joined: April 2017
Offline
Hi!

I would like to have 2 scatters of 20 points each and connect the point1 of the first scatter to the point1 of the second, etc.

I have placed a simple wrangle after each scatter to keep the the info of the point number even after I merge both scatters:

i@myptnum = i@ptnum;

The problem is I don't know how to use @myptnum to connect all 20 polylines.

Any help is appreciated!

-Olivier

Attachments:
CreateLines_from_2_scatters.JPG (103.4 KB)

User Avatar
Member
8551 posts
Joined: July 2007
Offline
append Add SOP

set Polygons/By Group/Add to By Attribute
and put myptnum as Attrib Name

it will connect all points with the same attrib, so if you have unique myptnum values on the left points and the same values in any order on the right points it will draw lines connecting those pairs of points
Tomas Slancik
FX Supervisor
Method Studios, NY
User Avatar
Member
1007 posts
Joined: April 2017
Offline
Ah! Simple solution!

Again, thanks for all your help, tamte!

-Olivier
User Avatar
Member
1007 posts
Joined: April 2017
Offline
Oh and, once I've got a bunch of lines and I subdivide them to have a mid point on each line, how do I select only the middle point of each line? Is using a For each a good idea? Is there an easier/faster to process method?

-Olivier
User Avatar
Member
1007 posts
Joined: April 2017
Offline
Ah! Found it!

I used the neighbourcount function:



i@group_mid = 0;

i@neigh = neighbourcount(0, @ptnum);



if(@neigh == 2)
{
@group_mid = 1;
}
User Avatar
Member
8551 posts
Joined: July 2007
Offline
if you want you can simplify that into a one liner (if you don't really need i@neigh as an attribute)
i@group_mid = neighbourcount(0, @ptnum) == 2;
Tomas Slancik
FX Supervisor
Method Studios, NY
User Avatar
Member
1007 posts
Joined: April 2017
Offline
Forgot about this old post!

Thanks.

-Olivier
  • Quick Links