diff options
author | Aaron Franke <arnfranke@yahoo.com> | 2021-01-12 13:45:31 -0500 |
---|---|---|
committer | Aaron Franke <arnfranke@yahoo.com> | 2021-01-12 13:46:16 -0500 |
commit | ddd6fb37e866026ce6b25a2e93adc062931a287e (patch) | |
tree | 0480eb82c38796d4a47d3e3813f3e9eacbcd9d16 /core | |
parent | bd07c5b7a8f6daa95a5cfa7a9f5c663a2553fd35 (diff) |
Update PolyPartition / Triangulator library
Diffstat (limited to 'core')
-rw-r--r-- | core/SCsub | 2 | ||||
-rw-r--r-- | core/math/geometry_2d.cpp | 14 | ||||
-rw-r--r-- | core/math/geometry_3d.cpp | 2 |
3 files changed, 9 insertions, 9 deletions
diff --git a/core/SCsub b/core/SCsub index c9f84a9a00..21829553a7 100644 --- a/core/SCsub +++ b/core/SCsub @@ -54,7 +54,7 @@ thirdparty_misc_sources = [ "smaz.c", # C++ sources "pcg.cpp", - "triangulator.cpp", + "polypartition.cpp", "clipper.cpp", ] thirdparty_misc_sources = [thirdparty_misc_dir + file for file in thirdparty_misc_sources] diff --git a/core/math/geometry_2d.cpp b/core/math/geometry_2d.cpp index 5d4c31088b..783750b9e6 100644 --- a/core/math/geometry_2d.cpp +++ b/core/math/geometry_2d.cpp @@ -31,7 +31,7 @@ #include "geometry_2d.h" #include "thirdparty/misc/clipper.hpp" -#include "thirdparty/misc/triangulator.h" +#include "thirdparty/misc/polypartition.h" #define STB_RECT_PACK_IMPLEMENTATION #include "thirdparty/misc/stb_rect_pack.h" @@ -39,16 +39,16 @@ Vector<Vector<Vector2>> Geometry2D::decompose_polygon_in_convex(Vector<Point2> polygon) { Vector<Vector<Vector2>> decomp; - List<TriangulatorPoly> in_poly, out_poly; + List<TPPLPoly> in_poly, out_poly; - TriangulatorPoly inp; + TPPLPoly inp; inp.Init(polygon.size()); for (int i = 0; i < polygon.size(); i++) { inp.GetPoint(i) = polygon[i]; } - inp.SetOrientation(TRIANGULATOR_CCW); + inp.SetOrientation(TPPL_ORIENTATION_CCW); in_poly.push_back(inp); - TriangulatorPartition tpart; + TPPLPartition tpart; if (tpart.ConvexPartition_HM(&in_poly, &out_poly) == 0) { // Failed. ERR_PRINT("Convex decomposing failed!"); return decomp; @@ -56,8 +56,8 @@ Vector<Vector<Vector2>> Geometry2D::decompose_polygon_in_convex(Vector<Point2> p decomp.resize(out_poly.size()); int idx = 0; - for (List<TriangulatorPoly>::Element *I = out_poly.front(); I; I = I->next()) { - TriangulatorPoly &tp = I->get(); + for (List<TPPLPoly>::Element *I = out_poly.front(); I; I = I->next()) { + TPPLPoly &tp = I->get(); decomp.write[idx].resize(tp.GetNumPoints()); diff --git a/core/math/geometry_3d.cpp b/core/math/geometry_3d.cpp index a918d1de0d..553184303d 100644 --- a/core/math/geometry_3d.cpp +++ b/core/math/geometry_3d.cpp @@ -33,7 +33,7 @@ #include "core/string/print_string.h" #include "thirdparty/misc/clipper.hpp" -#include "thirdparty/misc/triangulator.h" +#include "thirdparty/misc/polypartition.h" void Geometry3D::MeshData::optimize_vertices() { Map<int, int> vtx_remap; |