Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/prusa3d/PrusaSlicer.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/xs
diff options
context:
space:
mode:
authorAlessandro Ranellucci <aar@cpan.org>2013-11-06 22:38:10 +0400
committerAlessandro Ranellucci <aar@cpan.org>2013-11-06 22:38:10 +0400
commitd8e098ab0e7c925e0584564927faef7653ffb6ed (patch)
tree960d17fb19fe01413e7cb18c4809024563c054ec /xs
parentb5aaeb9b1259f4b6a7ce4f110eb58fc03415ca68 (diff)
Ported same_line() to XS
Diffstat (limited to 'xs')
-rw-r--r--xs/src/Line.cpp6
-rw-r--r--xs/src/Line.hpp1
-rw-r--r--xs/xsp/Line.xsp10
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, &center);
+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
+
%}
};