star-cpr

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

commit cc65cf5d2561666768ee2eb862c084e91868c766
parent 522d79db125cc8b0c1329eaf55bf1677df2de072
Author: Christophe Coustet <christophe.coustet@meso-star.com>
Date:   Fri,  3 Feb 2023 16:00:11 +0100

Check offsetting result polygon is in-range

Diffstat:
Msrc/scpr_polygon.c | 9+++++++++
1 file changed, 9 insertions(+), 0 deletions(-)

diff --git a/src/scpr_polygon.c b/src/scpr_polygon.c @@ -330,6 +330,15 @@ scpr_offset_polygon goto error; } + /* Check offset polygon will be in-range */ + if(offset > 0) { + double pt[2]; + d2_sub(pt, poly_desc->upper, d2(pt, -offset, -offset)); + ERR(check_and_truncate_vertex(pt)); + d2_add(pt, poly_desc->upper, d2(pt, offset, offset)); + ERR(check_and_truncate_vertex(pt)); + } + /* Check join type */ switch(join_type) { case SCPR_JOIN_SQUARE: