Skip to content
This repository was archived by the owner on Nov 12, 2021. It is now read-only.

Repository files navigation

Poly2Tri

Contribution to poly2tri project: https://github.com/greenm01/poly2tri.java

This is a temporary fork, in order to add various features.

A 2D constrained Delaunay triangulation library

Based on the paper "Sweep-line algorithm for constrained Delaunay triangulation" by V. Domiter and and B. Zalik

Officially supported langs: C++, Java

Community based langs (unsupported):
* AS3
* C
* C#, C#(basic)
* Go
* Haxe
* Javascript
* Python, Python3
* Ruby

Try it out online: click me or me!

Video poly2tri-java

If you want to triangulate complex or weak polygons you will need to prepare your data with a polygon clipping library like:
Clipper (C++, C#, Delphi)
Javascript Clipper
Java Clipper

BSD 3-Clause License

How to use

importorg.poly2tri.Poly2Tri;
importorg.poly2tri.geometry.polygon.Polygon;
importorg.poly2tri.geometry.polygon.PolygonPoint;
importorg.poly2tri.triangulation.delaunay.DelaunayTriangle;
importjava.util.Arrays;
publicclassMain {
publicstaticvoidmain(String[] args) {
// Prepare input dataPolygonpolygon = newPolygon(Arrays.asList(newPolygonPoint(0, 0, 0),
newPolygonPoint(10, 0, 1),newPolygonPoint(10, 10, 2),newPolygonPoint(0, 10, 3)));
// Launch tessellation Poly2Tri.triangulate(polygon);
// Gather trianglesList<DelaunayTriangle> triangles = polygon.getTriangles();
}
}

About

Contribution to poly2tri project. This is a temporary fork, in order to add various features.

Resources

Stars

39 stars

Watchers

2 watching

Forks

Releases

Packages

Used by

Contributors

Languages