diff options
author | Vojtech Bubnik <bubnikv@gmail.com> | 2022-03-31 13:20:46 +0300 |
---|---|---|
committer | PavelMikus <pavel.mikus.mail@seznam.cz> | 2022-04-25 13:42:51 +0300 |
commit | 7d02647ebfecddc8fb68fc0b7e731012d68a4d5c (patch) | |
tree | cc581301ab790ac4bd5d01f0fa733c71c4ac6b28 /xs | |
parent | 156a60017d7ebb37490351827b7e16c344d1fc0e (diff) |
Removed various Point::ccw() and Point::ccw_angle() methods, they were
provided for Perl bindings and their semantic was confusing.
Implemented free function angle() to measure angle between two vectors.
Reworked Polygon::convex/concave_points(), changed the meaning of their
angle threshold parameter.
Removed some unused methods from Perl bindings and tests.
Reworked the "wipe inside at the external perimeter" function
after Point::ccw_angle() was removed.
Diffstat (limited to 'xs')
-rw-r--r-- | xs/xsp/Line.xsp | 2 | ||||
-rw-r--r-- | xs/xsp/Point.xsp | 8 | ||||
-rw-r--r-- | xs/xsp/Polygon.xsp | 2 |
3 files changed, 2 insertions, 10 deletions
diff --git a/xs/xsp/Line.xsp b/xs/xsp/Line.xsp index 777dc41fa..36181c3ba 100644 --- a/xs/xsp/Line.xsp +++ b/xs/xsp/Line.xsp @@ -41,7 +41,7 @@ Clone<Point> normal(); Clone<Point> vector(); double ccw(Point* point) - %code{% RETVAL = THIS->ccw(*point); %}; + %code{% RETVAL = cross2((THIS->a - *point).cast<double>(), (THIS->b - THIS->a).cast<double>()); %}; %{ Line* diff --git a/xs/xsp/Point.xsp b/xs/xsp/Point.xsp index beefc6249..2d70e0203 100644 --- a/xs/xsp/Point.xsp +++ b/xs/xsp/Point.xsp @@ -39,13 +39,7 @@ double perp_distance_to_line(Line* line) %code{% RETVAL = line->perp_distance_to(*THIS); %}; double ccw(Point* p1, Point* p2) - %code{% RETVAL = THIS->ccw(*p1, *p2); %}; - double ccw_angle(Point* p1, Point* p2) - %code{% RETVAL = THIS->ccw_angle(*p1, *p2); %}; - Point* projection_onto_polygon(Polygon* polygon) - %code{% RETVAL = new Point(THIS->projection_onto(*polygon)); %}; - Point* projection_onto_polyline(Polyline* polyline) - %code{% RETVAL = new Point(THIS->projection_onto(*polyline)); %}; + %code{% RETVAL = cross2((*p1 - *THIS).cast<double>(), (*p2 - *p1).cast<double>()); %}; Point* projection_onto_line(Line* line) %code{% RETVAL = new Point(THIS->projection_onto(*line)); %}; Point* negative() diff --git a/xs/xsp/Polygon.xsp b/xs/xsp/Polygon.xsp index a94425477..6b6d52524 100644 --- a/xs/xsp/Polygon.xsp +++ b/xs/xsp/Polygon.xsp @@ -39,8 +39,6 @@ %code{% THIS->triangulate_convex(&RETVAL); %}; Clone<Point> centroid(); Clone<BoundingBox> bounding_box(); - Points concave_points(double angle); - Points convex_points(double angle); Clone<Point> point_projection(Point* point) %code{% RETVAL = THIS->point_projection(*point); %}; Clone<Point> intersection(Line* line) |