diff options
author | bubnikv <bubnikv@gmail.com> | 2019-11-22 20:22:44 +0300 |
---|---|---|
committer | bubnikv <bubnikv@gmail.com> | 2019-11-22 20:22:44 +0300 |
commit | 9c4dc80057dd311b2fee4c639918f0cf0b5642a1 (patch) | |
tree | 288fe14249c41a0f9b60720366fcc485622e4a7d /src/libslic3r/Line.cpp | |
parent | 232f3249990143709410fc02160fbaecb923baff (diff) |
Fix of the new gyroid infill path planning. Fixes #3226
Diffstat (limited to 'src/libslic3r/Line.cpp')
-rw-r--r-- | src/libslic3r/Line.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/libslic3r/Line.cpp b/src/libslic3r/Line.cpp index e5f7b8fa9..05cbfee4e 100644 --- a/src/libslic3r/Line.cpp +++ b/src/libslic3r/Line.cpp @@ -107,6 +107,17 @@ bool Line::intersection(const Line &l2, Point *intersection) const return false; // not intersecting } +bool Line::clip_with_bbox(const BoundingBox &bbox) +{ + Vec2d x0clip, x1clip; + bool result = Geometry::liang_barsky_line_clipping<double>(this->a.cast<double>(), this->b.cast<double>(), BoundingBoxf(bbox.min.cast<double>(), bbox.max.cast<double>()), x0clip, x1clip); + if (result) { + this->a = x0clip.cast<coord_t>(); + this->b = x1clip.cast<coord_t>(); + } + return result; +} + Vec3d Linef3::intersect_plane(double z) const { auto v = (this->b - this->a).cast<double>(); |