diff options
author | Alessandro Ranellucci <aar@cpan.org> | 2013-11-06 22:38:10 +0400 |
---|---|---|
committer | Alessandro Ranellucci <aar@cpan.org> | 2013-11-06 22:38:10 +0400 |
commit | d8e098ab0e7c925e0584564927faef7653ffb6ed (patch) | |
tree | 960d17fb19fe01413e7cb18c4809024563c054ec /xs | |
parent | b5aaeb9b1259f4b6a7ce4f110eb58fc03415ca68 (diff) |
Ported same_line() to XS
Diffstat (limited to 'xs')
-rw-r--r-- | xs/src/Line.cpp | 6 | ||||
-rw-r--r-- | xs/src/Line.hpp | 1 | ||||
-rw-r--r-- | xs/xsp/Line.xsp | 10 |
3 files changed, 17 insertions, 0 deletions
diff --git a/xs/src/Line.cpp b/xs/src/Line.cpp index 4f60a2304..612116091 100644 --- a/xs/src/Line.cpp +++ b/xs/src/Line.cpp @@ -54,6 +54,12 @@ Line::point_at(double distance) const return p; } +bool +Line::coincides_with(const Line* line) const +{ + return this->a.coincides_with(&line->a) && this->b.coincides_with(&line->b); +} + #ifdef SLIC3RXS void Line::from_SV(SV* line_sv) diff --git a/xs/src/Line.hpp b/xs/src/Line.hpp index 795590d5e..2545cc564 100644 --- a/xs/src/Line.hpp +++ b/xs/src/Line.hpp @@ -20,6 +20,7 @@ class Line double length() const; Point* midpoint() const; Point* point_at(double distance) const; + bool coincides_with(const Line* line) const; #ifdef SLIC3RXS void from_SV(SV* line_sv); diff --git a/xs/xsp/Line.xsp b/xs/xsp/Line.xsp index 39c54b48c..57ff19a39 100644 --- a/xs/xsp/Line.xsp +++ b/xs/xsp/Line.xsp @@ -46,5 +46,15 @@ Line::rotate(angle, center_sv) center.from_SV_check(center_sv); THIS->rotate(angle, ¢er); +bool +Line::coincides_with(line_sv) + SV* line_sv; + CODE: + Line line; + line.from_SV_check(line_sv); + RETVAL = THIS->coincides_with(&line); + OUTPUT: + RETVAL + %} }; |