Jump to content
DBaciu

Bad neighborhood

Recommended Posts

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

post-6076-0-52621600-1363300015_thumb.jp

Share this post


Link to post
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 this post


Link to post
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 this post


Link to post
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 this post


Link to post
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 this post


Link to post
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.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×