So i am trying to extract curves from objects imported from different software so i can use them for scatter. The reason i am using curves for scatter is because i can resample them.
The problem is that their direction is kinda … random … and it messes up my scatter. And i don't know how to correct that. The third picture shows the problem illustrated with an ends node.
So is there any node based way to automatically aim the curves at a similar direction ? And as i said the objects i import would be different in orientation, shape and position so if the fix is based on the scenes xyz values it probably wont work.
Btw the way i generate the curves is by slicing the geometry before importing it to houdini. Then i “fuse” it and use the fuse points to generate the middle edge group. Then generate the parallel or perpendicular curves based on it. So if this can be used in some way …
Match curves direction
2274 3 1-
- SnowballWar
- Member
- 39 posts
- Joined: March 2020
- Offline
-
- Herve
- Member
- 40 posts
- Joined: Aug. 2018
- Offline
I can think of two ways, there surely more…
1. Starting from the third image/stage:
- give (point) normals to the geometry. even with a simple point wrangle of one line, like:- next, plug an attribute promote node. Method “average”, source as “points”, promoted to “detail”. Use N attribute as source and a new name for this new detail attibute like “averageNorm”. You'll next use this detail attribute to check if each prim need to be reversed or not, since it's basically the equivalent of a primitive normal (an abstraction, inside Houdini)
- do this check either in a wrangle node, or with a simple switch embedded inside a “for each connected piece”. second input of the switch (in this example) would just be a reverse node. the switch expression would be something like: (checking the Y component of avgN here, just to mimic your apparent situation)00.
2. second option, would be to start correcting things earlier. When you close your spline (between images 2 and 3)/rebuild them with another method of yours, the “direction” of their average normal is deduced by Houdini based on their point order. activating the display of such is often a good idea to check that, btw. So, you could use a sort node on each spline to get a similar “flow order”, so to speak, of points, resulting in closed curved having the same direction.
I can send a file asap when getting back home later, if you'd like, as atm I'm at work and can't make/send such a file, halas. Hope it helps, though.
1. Starting from the third image/stage:
- give (point) normals to the geometry. even with a simple point wrangle of one line, like:
v@N = @N;
- do this check either in a wrangle node, or with a simple switch embedded inside a “for each connected piece”. second input of the switch (in this example) would just be a reverse node. the switch expression would be something like:
detail(0, "averageNorm", 1)<0
2. second option, would be to start correcting things earlier. When you close your spline (between images 2 and 3)/rebuild them with another method of yours, the “direction” of their average normal is deduced by Houdini based on their point order. activating the display of such is often a good idea to check that, btw. So, you could use a sort node on each spline to get a similar “flow order”, so to speak, of points, resulting in closed curved having the same direction.
I can send a file asap when getting back home later, if you'd like, as atm I'm at work and can't make/send such a file, halas. Hope it helps, though.
Edited by Herve - July 23, 2020 05:06:33
-
- SnowballWar
- Member
- 39 posts
- Joined: March 2020
- Offline
-
- SnowballWar
- Member
- 39 posts
- Joined: March 2020
- Offline
-
- Quick Links