Finding the next nearest point along edge
10334 12 4- adam_glazier
- Member
- 41 posts
- Joined:
- Offline
I have a jagged line with oddly ordered points, that Sort SOP is incapable of fixing.
Is there an expression or some method to start with one end of the line and find each next point?
Since the line is jagged, using nearpoint() finds points that are not the next one along the edge.
I can see the points connected by edges, but can't seem to find any info on how to use what I see.
Any one else run into this problem and find a way around it??
Is there an expression or some method to start with one end of the line and find each next point?
Since the line is jagged, using nearpoint() finds points that are not the next one along the edge.
I can see the points connected by edges, but can't seem to find any info on how to use what I see.
Any one else run into this problem and find a way around it??
~adam
- symek
- Member
- 1390 posts
- Joined: July 2005
- Offline
- adam_glazier
- Member
- 41 posts
- Joined:
- Offline
- symek
- Member
- 1390 posts
- Joined: July 2005
- Offline
I have no idea how to deal with such cases in general. This is not a curve, there are several polygons in that edge. Sorting with Z-axes worked fine here, but I'm not sure for what purpose you need this reordering, so hard to judge if this is what you want.
There is an expression returning nearest point belonging to the same polygon as I remember (?) (or you can search for a nearest point with additional expression conditioning polygon membership). But this wouldn't work with “messy” issues also I suspect.
There is an expression returning nearest point belonging to the same polygon as I remember (?) (or you can search for a nearest point with additional expression conditioning polygon membership). But this wouldn't work with “messy” issues also I suspect.
- andrewlowell
- Member
- 537 posts
- Joined: Dec. 2005
- Offline
Maybe this will help .. I've needed to do this in the past, so I've been meaning to make an easy solution for it.
This method finds 1st,2nd, up to 10th nearest pts. I used mainly CHOPs, but I don't think this solution is near as elegant as it could be with a python CHOP.
I made the basic method into a digital asset and should be pretty easy to use. I think this would be best implemented with copy-stamping attributes though, and dealing only (at the user level) with geometry and not CHOPs. Let me know if you can get this to work for your application
This method finds 1st,2nd, up to 10th nearest pts. I used mainly CHOPs, but I don't think this solution is near as elegant as it could be with a python CHOP.
I made the basic method into a digital asset and should be pretty easy to use. I think this would be best implemented with copy-stamping attributes though, and dealing only (at the user level) with geometry and not CHOPs. Let me know if you can get this to work for your application
- adam_glazier
- Member
- 41 posts
- Joined:
- Offline
It's really neat to see the way you used CHOPs to do all that. I never thought of using it that way. Very creative.
Just like the expression nearpoint(), it works for finding the nearest point in space. I can't get it to find the next point on the line though. …which is what I'm trying to do. Does it do that?
Just like the expression nearpoint(), it works for finding the nearest point in space. I can't get it to find the next point on the line though. …which is what I'm trying to do. Does it do that?
~adam
- andrewlowell
- Member
- 537 posts
- Joined: Dec. 2005
- Offline
- adam_glazier
- Member
- 41 posts
- Joined:
- Offline
I guess the burning question is…
Does Houdini provide a way to tell if two points are connected by an edge?
If this is possible, the we could use a method like yours andrewlowell to find the next point and store it in an array to prevent it from being looked up again…thus finding the true next point regardless of it's point number or position.
Does Houdini provide a way to tell if two points are connected by an edge?
If this is possible, the we could use a method like yours andrewlowell to find the next point and store it in an array to prevent it from being looked up again…thus finding the true next point regardless of it's point number or position.
~adam
- adam_glazier
- Member
- 41 posts
- Joined:
- Offline
After looking at it further, your right SYmek. Sorting by vertex would work on a single line like I want, but the error I am experiencing is caused by multiple primitives making up what looks like a single line.
Now, I feel like a shmuck going on and on about finding the next point on a line. I'm also stumped at how to deal with these types of errors produced by a Cookie SOP (see error example attached).
Now, I feel like a shmuck going on and on about finding the next point on a line. I'm also stumped at how to deal with these types of errors produced by a Cookie SOP (see error example attached).
~adam
- Simon
- Member
- 2199 posts
- Joined: July 2005
- Online
- adam_glazier
- Member
- 41 posts
- Joined:
- Offline
- Simon
- Member
- 2199 posts
- Joined: July 2005
- Online
- adam_glazier
- Member
- 41 posts
- Joined:
- Offline
-
- Quick Links