From d34c9cec9a31faffc9af82f5d4317599b2e147e1 Mon Sep 17 00:00:00 2001 From: enricoturri1966 Date: Fri, 22 Oct 2021 14:29:56 +0200 Subject: [PATCH] Follow-up of decdaa82d3db9619b45d3c59d5106526cf65d57d - Use normalized vectors --- src/libslic3r/Line.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/libslic3r/Line.cpp b/src/libslic3r/Line.cpp index 78ca2b9af..773df3442 100644 --- a/src/libslic3r/Line.cpp +++ b/src/libslic3r/Line.cpp @@ -67,7 +67,7 @@ bool Line::parallel_to(const Line& line) const { const Vec2d v1 = (this->b - this->a).cast(); const Vec2d v2 = (line.b - line.a).cast(); - return std::fabs(cross2(v1, v2)) < EPSILON; + return sqr(cross2(v1, v2)) < sqr(EPSILON) * v1.squaredNorm() * v2.squaredNorm(); } #if ENABLE_OUT_OF_BED_DETECTION_IMPROVEMENTS @@ -80,7 +80,7 @@ bool Line::perpendicular_to(const Line& line) const { const Vec2d v1 = (this->b - this->a).cast(); const Vec2d v2 = (line.b - line.a).cast(); - return std::fabs(v1.dot(v2)) < EPSILON; + return sqr(v1.dot(v2)) < sqr(EPSILON) * v1.squaredNorm() * v2.squaredNorm(); } #endif // ENABLE_OUT_OF_BED_DETECTION_IMPROVEMENTS