mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-05-17 02:22:17 +00:00
Modified implementation of Line::parallel_to(const Line& line) and Line::perpendicular_to(const Line& line)
This commit is contained in:
@@ -63,11 +63,25 @@ bool Line::parallel_to(double angle) const
|
||||
return Slic3r::Geometry::directions_parallel(this->direction(), angle);
|
||||
}
|
||||
|
||||
bool Line::parallel_to(const Line& line) const
|
||||
{
|
||||
const Vec2d v1 = (this->b - this->a).cast<double>();
|
||||
const Vec2d v2 = (line.b - line.a).cast<double>();
|
||||
return std::fabs(cross2(v1, v2)) < EPSILON;
|
||||
}
|
||||
|
||||
#if ENABLE_OUT_OF_BED_DETECTION_IMPROVEMENTS
|
||||
bool Line::perpendicular_to(double angle) const
|
||||
{
|
||||
return Slic3r::Geometry::directions_perpendicular(this->direction(), angle);
|
||||
}
|
||||
|
||||
bool Line::perpendicular_to(const Line& line) const
|
||||
{
|
||||
const Vec2d v1 = (this->b - this->a).cast<double>();
|
||||
const Vec2d v2 = (line.b - line.a).cast<double>();
|
||||
return std::fabs(v1.dot(v2)) < EPSILON;
|
||||
}
|
||||
#endif // ENABLE_OUT_OF_BED_DETECTION_IMPROVEMENTS
|
||||
|
||||
bool Line::intersection(const Line &l2, Point *intersection) const
|
||||
|
||||
Reference in New Issue
Block a user