star-cpr

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

commit e8b3d8f1e3e18f9e51768c318a52c21a8b86a6d2
parent da7898351322be663b6c7cca61b5e8d0454c8e2e
Author: Christophe Coustet <christophe.coustet@meso-star.com>
Date:   Wed, 13 Sep 2023 14:33:36 +0200

Rename point_in_component into is_vertex_in_component

Diffstat:
Msrc/scpr.h | 7+++++--
Msrc/scpr_polygon.c | 8++++----
2 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/src/scpr.h b/src/scpr.h @@ -238,6 +238,8 @@ scpr_polygon_is_component_cw const size_t icomponent, int* cw); +/* Reverse the polygon component orientation. + * Only meaningful for simple polygons. */ SCPR_API res_T scpr_polygon_reverse_component (struct scpr_polygon* polygon, @@ -251,11 +253,12 @@ scpr_polygon_eq const struct scpr_polygon* polygon2, int* is_eq); +/* Check if a given vertex is in a given component. */ SCPR_API res_T -scpr_point_in_component +scpr_is_vertex_in_component (const struct scpr_polygon* polygon, const size_t icomponent, - const double point[2], + const double vertex[2], int* situation); /* +1: inside, 0: on, -1: outside */ SCPR_API res_T diff --git a/src/scpr_polygon.c b/src/scpr_polygon.c @@ -551,10 +551,10 @@ error: } res_T -scpr_point_in_component +scpr_is_vertex_in_component (const struct scpr_polygon* polygon, const size_t icomponent, - const double point[2], + const double vertex[2], int* situation) { res_T res = RES_OK; @@ -562,12 +562,12 @@ scpr_point_in_component Clipper2Lib::Point64 pt; Clipper2Lib::PointInPolygonResult in; - if(!polygon || !point || !situation || icomponent >= polygon->paths.size()) { + if(!polygon || !vertex || !situation || icomponent >= polygon->paths.size()) { res = RES_BAD_ARG; goto error; } - ERR(scpr_device_scale(polygon->device, point, 2, tmp64)); + ERR(scpr_device_scale(polygon->device, vertex, 2, tmp64)); TRY(pt.Init(SPLIT2(tmp64))); TRY(in = Clipper2Lib::PointInPolygon(pt, polygon->paths[icomponent])); enum class PointInPolygonResult { IsOn, IsInside, IsOutside };