Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extra Vertex in TriangulatedPolygonGenerator #145

Closed
runette opened this issue Jul 17, 2020 · 2 comments
Closed

Extra Vertex in TriangulatedPolygonGenerator #145

runette opened this issue Jul 17, 2020 · 2 comments

Comments

@runette
Copy link

runette commented Jul 17, 2020

Hi

I am using TriangulatedPolygonGenerator to mesh Polygons with holes. It mostly seems to work very well, but sometimes it seems to add a vertex to one of the linear rings of the polygon. I have not been able to work out a pattern to why it is doing this.

Do you have any idea of why this is happening?

This is a problem since what I am actually doing is using this to triangulated a 2.5D Polygon - using OrthogonalPlaneFit3 to find the nearest plane, projecting the vertices onto the plane as a Polygon2D and then creating the triangulation. Unfortunately, I cannot project back to the original points - I have to do a matching between the Polygon2D vertices and the 3D vertices in the triangulation (and there does not seem to be a simple mapping between the vertices in the final mesh and the vertices from the original Polygon2D). At the moment I have to do some fancy footwork around the extra vertex if it there - and it also means that I do not have round trip integrity.

@rms80
Copy link
Contributor

rms80 commented Aug 16, 2020

The triangulation method used in TriangulatedPolygonGenerator does this, sorry. It's because it does not actually triangulate the polygon, it cuts the polygon into a mesh (a rectangle formed from 2 triangles), by incrementally inserting the edges. Sometimes this adds vertices. It's not really the right way to triangulate a polygon - Delaunay triangulation works better, but the library does not have an implementation of that.

TriangulatedPolygonGenerator is just a wrapper around MeshInsertUVPolycurve, which has a function Simplify() which will try to remove these extra vertices. However it doesn't always work.

@runette
Copy link
Author

runette commented Aug 16, 2020 via email

@runette runette closed this as completed Oct 9, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants