Jump to content

Bad neighborhood


DBaciu

Recommended Posts

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.

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

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...