## Recommended Posts

See the image. The one who can help me with this issue will have a beer from me

##### Share on other sites

What have you tried so far?

I'm not entirely sure off the top of my head but I'd have a go at:

http://www.sidefx.com/docs/houdini12.1/nodes/vop/neighbour

And by deduction post vop I'm sure you'll be able to get what you want.

##### Share on other sites

I haven't tried much so far because I'm busy , I hoped someone already know the answer to this.

##### Share on other sites

Well you could in vop, loop over all the connected points and use atan2 to check the angle between two segments,

the one with the smallest (positive)angle difference is the next segment I guess.

##### Share on other sites

Well you could in vop, loop over all the connected points and use atan2 to check the angle between two segments,

the one with the smallest (positive)angle difference is the next segment I guess.

Would this be true in a 3d space, not just 2d plane? (think a fold in a geometry) - the folded angle might be less than the connected angle. Otherwise a nice solution.

I would go with stepping along the neighbors (neighbour vop). And trying to find the neighbours that both point 1 and point 6 have in common. The snag is point 34 rather than point 6, so you would have to look up the neighbour of point 34 and check if its' neighbours contain a point shared by the originals. In essence you are walking along the edge till you find a point that they both have in common. In order to check if a point is a 'T-split' point or an unconnected point, you can count the number of neighbours.

##### Share on other sites

Would this be true in a 3d space, not just 2d plane? (think a fold in a geometry) - the folded angle might be less than the connected angle. Otherwise a nice solution.

Since its for a roof, it could easily treated as a 2d plane, just neglecting the y coordinate. (like the picture)

If you want to do a true 3d next connection check, just replace atan2 with a dot product of the normalized vectors of the connections.

eg:

Dot(Normalize(point9-point1),Normalize(point6-point1)) is smaller than:

Dot(Normalize(point9-point1),Normalize(point6-point21))

Edited by acey195

##### Share on other sites

Well yeah, thank you both. Indeed, like Acey said, the y coordinate can be ignored in this case. I went with the dot product in the end, It felt better suited for the task for a number of reasons. Also I felt that the atan2 solution is less accurate. Working on this thing I learned that it's better not to test if some value is equal with 0 but if is smaller than 0.0001.

## Create an account

Register a new account