Reorder points

   Views 19191   Replies 5   Subscribers 2
User Avatar
Member
319 posts
Joined: Jan. 2013
Offline
There are points, randomly scattered, to make a procedural order that they always were as follows:

0 1 2
3 4 5
6 7 8

Actually point may not have the correct topology can be stretched in different directions.
How can I change the order of the points? I tried to use the Sort SOP, but it is not much help. Does anyone have any ideas?

Attachments:
Untitled-1.jpg (57.3 KB)

User Avatar
Member
279 posts
Joined: Dec. 2009
Offline
I don't think so you tried very long time Sort SOP.

Anyway, here the solution:
1. one Sort SOP, and sort points ‘by x’
2. another one, and sort points ‘by z’

Voilà
User Avatar
Member
319 posts
Joined: Jan. 2013
Offline
Thank you, fsimerey! Yes, the methods of double sorting everything works.
But this will not work if the points will be some movement on its axis relative to each other.

Attachments:
points.png (3.1 KB)

User Avatar
Member
387 posts
Joined: July 2005
Offline
It's hard to know what you want to do, but here's an line of thought: you can create lots of additional point attributes attached to each point with an ATTRIBUTE CREATE SOP. This might lead you down the right track for what you want to do.

For example, to start, you could make a new point attribute called ‘origPt’ and copy the point number values to this new attribute. Now you have the point numbers, and the original point numbers. If you do a sort, the point numbers will change, but the ‘origPt’ attributes do not. They stay unchanged.

Now, you could have attributes which represent the “point numbers” for sorting along each axis. The Sort Sop will only change the ‘built-in’ point numbers attribute, but there's many SOPS which address user-added attributes. Hit Tab in SOP's Network and look in the Attributes Menu. Add as many new point attributes as you like, for a view along each axis, etc.. HTH. b.
''You're always doing this: reducing it to science. Why can't it be real?'' – Jackie Tyler
User Avatar
Member
1 posts
Joined: Dec. 2024
Offline
I need help, I would like to know if there is any method to reorder the points in sequence (preferably in VEX), what I want to achieve is that the line connects with the next point as in image 2. Thank you

Attachments:
Photoshop_eDj08Z4Yrh.png (695.4 KB)

tacorco
User Avatar
Member
4828 posts
Joined: Feb. 2012
Offline
tacorco
I need help, I would like to know if there is any method to reorder the points in sequence (preferably in VEX), what I want to achieve is that the line connects with the next point as in image 2. Thank you

Hi,

There’s no direct way to reorder points in VEX. However, you can start from the first point, find its nearest neighbor, and create a direction vector between them. Then, in each iteration, use the pccone [www.sidefx.com] function to find the next nearest point within a cone, and afterward update the direction using the most recent pair of points.
Senior FX TD @ Industrial Light & Magic
Get to the NEXT level in Houdini & VEX with Pragmatic VEX! [www.pragmatic-vfx.com] https://lnk.bio/animatrix [lnk.bio]
  • Quick Links