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

Correct Polygon Triangulation #17

Open
DominicDolan opened this issue Nov 3, 2020 · 0 comments
Open

Correct Polygon Triangulation #17

DominicDolan opened this issue Nov 3, 2020 · 0 comments
Labels
bug Something isn't working computational geometry enhancement New feature or request
Milestone

Comments

@DominicDolan
Copy link
Owner

DominicDolan commented Nov 3, 2020

Info

Currently there is a basic way of performing triangulation which uses a Graham Scan triangulation technique. This algorithm performs alright in terms of efficiency but it fails for anything but a simple polygon (a polygon that does not intersect itself and has no holes). Additionally, its current implementation has a bug where it skips the starting point if that point is concave.

The current implementation can be used by getting an instance of the GrahamScanTriangulator:

val triangulator: Triangulator = GrahamScanTriangulator(vertices)

where vertices is the set of vertices that describes the polygon. Once the instance is created, the indices for the pollygon can be found from the value returned by triangulate():

val indices: ShortArray = triangulator.triangulate()

These indices can then be passed into OpenGL as an Element Index Array to correctly render the polygon. An example of this procedure can be found in the PolygonModel class.

Motive

It would be helpful to have a method for triangulating polygons that is more powerful more efficient and more reliable

Task

Implement an Algorithm for triangulating polygons that is better than what is there. This can be done by creating a class that extends the Triangulator abstract class and output the triangulation data to indices: ShortArray inside the Triangulator class.

A good algorithm for triangulation can be found in Computational Geometry - Algorithms and Applications by Mark de Berg which uses Monotone Polygon Triangulation.

@DominicDolan DominicDolan added bug Something isn't working enhancement New feature or request labels Nov 3, 2020
@DominicDolan DominicDolan added this to the General milestone Nov 3, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working computational geometry enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant