2D constrained Delaunay triangulation library
Go to file
Pierre Dejoue 49a12eb378 Set the API export symbols based on CMake BUILD_SHARED_LIBS
By default poly2tri is built as a static library.
2022-04-23 14:20:20 +02:00
.github/workflows Add CMake files for the unit tests 2020-08-27 19:16:17 +02:00
.vscode Add debug configurations for VSCode 2020-10-19 18:27:52 +02:00
doc Add references section to README 2020-10-26 20:58:49 +01:00
poly2tri Retakes on dllexport/dllimport 2022-04-20 21:52:16 +02:00
testbed Rename testbed/testbed to testbed/p2t 2021-12-01 17:36:31 -06:00
unittest ConcaveBoundaryTest unit test 2022-03-15 20:37:14 -05:00
.clang-format Add .clang-format 2020-10-19 18:24:46 +02:00
.gitignore Ignore .cache/ 2020-12-17 23:13:20 +01:00
AUTHORS modified Authors file 2010-01-30 13:10:18 -05:00
CMakeLists.txt Set the API export symbols based on CMake BUILD_SHARED_LIBS 2022-04-23 14:20:20 +02:00
LICENSE Change BSD-3 license formatting a little bit so that GitHub detects it 2018-09-11 13:00:49 +02:00
meson.build Add CMake files for the unit tests 2020-08-27 19:16:17 +02:00
README.md Consistent executable path in README.md 2021-12-01 17:38:53 -06:00

Since there are no Input validation of the data given for triangulation you need to think about this. Poly2Tri does not support repeat points within epsilon.

  • If you have a cyclic function that generates random points make sure you don't add the same coordinate twice.
  • If you are given input and aren't sure same point exist twice you need to check for this yourself.
  • Only simple polygons are supported. You may add holes or interior Steiner points
  • Interior holes must not touch other holes, nor touch the polyline boundary
  • Use the library in this order:
    1. Initialize CDT with a simple polyline (this defines the constrained edges)
    2. Add holes if necessary (also simple polylines)
    3. Add Steiner points
    4. Triangulate

Make sure you understand the preceding notice before posting an issue. If you have an issue not covered by the above, include your data-set with the problem. The only easy day was yesterday; have a nice day.

TESTBED INSTALLATION GUIDE

Dependencies

Core poly2tri lib:

  • Standard Template Library (STL)

Unit tests:

  • Boost (filesystem, test framework)

Testbed:

Build the library

With the ninja build system installed:

mkdir build && cd build
cmake -GNinja ..
cmake --build .

Build and run with unit tests

With the ninja build system:

mkdir build && cd build
cmake -GNinja -DP2T_BUILD_TESTS=ON ..
cmake --build .
ctest --output-on-failure

Build with the testbed

mkdir build && cd build
cmake -GNinja -DP2T_BUILD_TESTBED=ON ..
cmake --build .

Running the Examples

Load data points from a file:

build/testbed/p2t <filename> <center_x> <center_y> <zoom>

Random distribution of points inside a constrained box:

build/testbed/p2t random <num_points> <box_radius> <zoom>

Examples:

build/testbed/p2t testbed/data/dude.dat 300 500 2
build/testbed/p2t testbed/data/nazca_monkey.dat 0 0 9

build/testbed/p2t random 10 100 5.0
build/testbed/p2t random 1000 20000 0.025

References

  • Domiter V. and Zalik B. (2008) Sweepline algorithm for constrained Delaunay triangulation
  • FlipScan by library author Thomas Åhlén

FlipScan