mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-06-05 19:42:47 +00:00
Iterative, not recursive, version of the Douglas-Peucker-Ramer algorithm
based on the work by @fuchstraumer https://github.com/slic3r/Slic3r/pull/3825 https://gist.github.com/fuchstraumer/9421573fc281b946e5f561758961212a which was based on http://anis-moussa.blogspot.com/2014/03/ramer-douglas-peucker-algorithm-for.html
This commit is contained in:
@@ -31,7 +31,8 @@ public:
|
||||
Point midpoint() const { return (this->a + this->b) / 2; }
|
||||
bool intersection_infinite(const Line &other, Point* point) const;
|
||||
bool operator==(const Line &rhs) const { return this->a == rhs.a && this->b == rhs.b; }
|
||||
double distance_to(const Point &point) const;
|
||||
double distance_to_squared(const Point &point) const { return distance_to_squared(point, this->a, this->b); }
|
||||
double distance_to(const Point &point) const { return distance_to(point, this->a, this->b); }
|
||||
double perp_distance_to(const Point &point) const;
|
||||
bool parallel_to(double angle) const;
|
||||
bool parallel_to(const Line &line) const { return this->parallel_to(line.direction()); }
|
||||
@@ -43,6 +44,9 @@ public:
|
||||
bool intersection(const Line& line, Point* intersection) const;
|
||||
double ccw(const Point& point) const { return point.ccw(*this); }
|
||||
|
||||
static double distance_to_squared(const Point &point, const Point &a, const Point &b);
|
||||
static double distance_to(const Point &point, const Point &a, const Point &b) { return sqrt(distance_to_squared(point, a, b)); }
|
||||
|
||||
Point a;
|
||||
Point b;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user