mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-05-31 09:02:53 +00:00
Use a more robust parallelism detection
This commit is contained in:
@@ -111,6 +111,17 @@ Line::direction() const
|
||||
: atan2;
|
||||
}
|
||||
|
||||
bool
|
||||
Line::parallel_to(double angle) const {
|
||||
double diff = abs(this->direction() - angle);
|
||||
return (diff < EPSILON) || (abs(diff - PI) < EPSILON);
|
||||
}
|
||||
|
||||
bool
|
||||
Line::parallel_to(const Line &line) const {
|
||||
return this->parallel_to(line.direction());
|
||||
}
|
||||
|
||||
Vector
|
||||
Line::vector() const
|
||||
{
|
||||
|
||||
@@ -28,6 +28,8 @@ class Line
|
||||
Point point_at(double distance) const;
|
||||
bool coincides_with(const Line &line) const;
|
||||
double distance_to(const Point &point) const;
|
||||
bool parallel_to(double angle) const;
|
||||
bool parallel_to(const Line &line) const;
|
||||
double atan2_() const;
|
||||
double direction() const;
|
||||
Vector vector() const;
|
||||
|
||||
Reference in New Issue
Block a user