Modified implementation of Line::parallel_to(const Line& line) and Line::perpendicular_to(const Line& line)
This commit is contained in:
parent
b6b5bdb592
commit
decdaa82d3
2 changed files with 16 additions and 2 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue