star-cpr

Clip 2D meshes with 2D polygons
git clone git://git.meso-star.fr/star-cpr.git
Log | Files | Refs | README | LICENSE

commit 0221804610d6d6e17df8ccfa0c6af99d1c04dd92
parent 414ac1e7854377669ca39ca8eb3b69e0ab117a43
Author: Christophe Coustet <christophe.coustet@meso-star.com>
Date:   Mon,  3 Oct 2022 14:49:53 +0200

BugFix: use new/delete to allow Clipper2 stuff

Diffstat:
Msrc/scpr_polygon.c | 5++++-
1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/scpr_polygon.c b/src/scpr_polygon.c @@ -45,7 +45,8 @@ polygon_release(ref_T* ref) struct scpr_polygon* polygon; ASSERT(ref); polygon = CONTAINER_OF(ref, struct scpr_polygon, ref); - polygon->paths.clear(); + /* Call destructor for paths */ + polygon->paths.Clipper2Lib::PathsD::~PathsD(); MEM_RM(polygon->allocator, polygon); } @@ -125,6 +126,8 @@ scpr_polygon_create } ref_init(&polygon->ref); polygon->allocator = allocator; + /* Allocate paths the C++ way (placement new) */ + new (&polygon->paths) Clipper2Lib::PathsD; d2_splat(polygon->lower, DBL_MAX); d2_splat(polygon->upper,-DBL_MAX);