Commit Graph

58 Commits

Author SHA1 Message Date
enricoturri1966
9af9b9b35d Tech ENABLE_OUT_OF_BED_DETECTION_IMPROVEMENTS set as default 2021-11-16 12:39:54 +01:00
Vojtech Bubnik
cc44089440 New BuildVolume class was created, which detects build volume type (rectangular,
circular, convex, concave) and performs efficient collision detection agains these build
volumes. As of now, collision detection is performed against a convex
hull of a concave build volume for efficency.

GCodeProcessor::Result renamed out of GCodeProcessor to GCodeProcessorResult,
so it could be forward declared.

Plater newly exports BuildVolume, not Bed3D. Bed3D is a rendering class,
while BuildVolume is a purely geometric class.

Reduced usage of global wxGetApp, the Bed3D is passed as a parameter
to View3D/Preview/GLCanvas.

Convex hull code was extracted from Geometry.cpp/hpp to Geometry/ConvexHulll.cpp,hpp.
New test inside_convex_polygon().
New efficent point inside polygon test: Decompose convex hull
to bottom / top parts and use the decomposition to detect point inside
a convex polygon in O(log n). decompose_convex_polygon_top_bottom(),
inside_convex_polygon().

New Circle constructing functions: circle_ransac() and circle_taubin_newton().

New polygon_is_convex() test with unit tests.
2021-11-16 10:15:51 +01:00
Vojtech Bubnik
cf7b6fb19a Extracted MedialAxis code from Geometry.cpp/hpp, moved to its own
files to Geometry/
Moved other Voronoi files to Geometry/
2021-10-27 16:03:04 +02:00
Vojtech Bubnik
497905406b New code for minimum enclosing circle by randomized Welzl algorithm.
Split the circle code from Geometry.cpp/hpp to Geometry/Circle.cpp,hpp
2021-10-27 15:12:29 +02:00
Vojtech Bubnik
be236eda85 Renamed Geometry::intersect() to Geometry::convex_polygons_intersect()
to convey its true meaning.
2021-10-23 15:29:18 +02:00
enricoturri1966
a9ca63d344 Merge branch 'master' of https://github.com/prusa3d/PrusaSlicer into et_sinking_objects_collision 2021-10-04 15:04:34 +02:00
tamasmeszaros
4cc1b2740d Don't report intersection if two polygons are only touching. 2021-10-04 14:16:13 +02:00
enricoturri1966
5739178306 Merge branch 'master' of https://github.com/prusa3d/PrusaSlicer into et_sinking_objects_collision 2021-10-04 13:07:53 +02:00
tamasmeszaros
9fce0ce3a6 Fix compile issues and overlapping polygon fails 2021-10-01 18:27:37 +02:00
enricoturri1966
f3bd5e96c5 Tech ENABLE_OUT_OF_BED_DETECTION_IMPROVEMENTS - Fixed detection of collision with circular printbed in backend 2021-10-01 07:28:10 +02:00
Lukas Matena
476b48ed11 Revert "Merge branch 'tm_convex_intersect_rotcalip'"
This reverts commit 627d8bcaef, reversing
changes made to 66d4462724.

The change breaks build on mac
2021-09-30 16:49:00 +02:00
tamasmeszaros
234f062ad4 Fast convex polygon intersection test with rotating calipers 2021-09-30 15:49:12 +02:00
enricoturri1966
7cfe082621 Tech ENABLE_OUT_OF_BED_DETECTION_IMPROVEMENTS - Enable detection of collision with circular printbed for toolpaths 2021-09-30 12:08:05 +02:00
enricoturri1966
cf380fb456 Tech ENABLE_OUT_OF_BED_DETECTION_IMPROVEMENTS - Out of bed detection for circular printbeds 2021-09-21 13:51:57 +02:00
Vojtech Bubnik
8d0950ce12 Convincing ClipperLib to use Slic3r's own Point type internally. 2021-04-21 20:15:49 +02:00
Vojtech Bubnik
8fd731f7a0 New FDM support sparse infill zig-zag algorithm.
Fixed some old support and infill issues.

Fixes support problem #4295
Fixes Parts of interface layer extends beyond supports and cannot be printed
Fixes support missing under horizontal overhang #6058
Fixes Slicer double-traces small sections of Rectilinear Supports, causes
Fixes plastic buildup and nozzle crashes #4951
Fixes Add "Angle Interface layers" #2969
2021-04-08 15:29:40 +02:00
Vojtech Bubnik
05a6cfeaea Some more reduction of compiler warnings on MSVC 2021-02-10 18:04:16 +01:00
Vojtech Bubnik
db2d78ff21 Reduction on compiler warnings, mainly on MSVC.
Fix of the new gap_fill_enable flag: Take it into account when comparing
regions.
2021-02-10 17:29:07 +01:00
Lukas Matena
b85de89751 Fixing Clang warnings 2 2021-02-08 17:52:29 +01:00
Lukáš Hejl
f0616b0736 Fixed return value of liang_barsky_line_clipping 2020-12-01 14:28:27 +01:00
Vojtech Bubnik
84693a5810 New get_extents(const std::vector<Points> &pts),
refactored Lian Barsky line clipping
2020-11-16 10:20:47 +01:00
Vojtech Bubnik
239d588c5d 1) Implemented anchoring of infill lines to perimeters with length
limited anchors, while before a full perimeter segment was always
   taken if possible.
2) Adapted the line infills (grid, stars, triangles, cubic) to 1).
   This also solves a long standing issue of these infills producing
   anchors for each sweep direction independently, thus possibly
   overlapping and overextruding, which was quite detrimental
   in narrow areas.
3) Refactored cubic adaptive infill anchroing algorithm
   for performance and clarity.
2020-11-05 17:32:40 +01:00
Vojtech Bubnik
37c5fe9923 Refactoring of adaptive cubic / support cubic:
1) Octree is built directly from the triangle mesh by checking
   overlap of a triangle with an octree cell. This shall produce
   a tighter octree with less dense cells.
2) The same method is used for both the adaptive / support cubic infill,
   where for the support cubic infill the non-overhang triangles are
   ignored.
The AABB tree is no more used.
3) Optimized extraction of continuous infill lines in O(1) instead of O(n^2)
2020-09-17 18:39:28 +02:00
Vojtech Bubnik
b101a8e266 Fixes of the offset curves from Voronoi diagram.
The offset curve extractor is already quite usable,
though singular cases are still not covered yet
when the offset curve intersects or nearly intersects
a Voronoi vertex.

Removal of the PRINTF_ZU "%zu" Visual Studio printf compatibility macro.
Fixes of a contours self intersection test for collinear segments.
SVG exporter now exports white background, so that the GNOME Eye viewer is usable.
2020-06-16 13:15:48 +02:00
Vojtech Bubnik
6f4d24ab95 WIP: Generating offset curves with properly rounded corners from
a Voronoi diagram. Curve extraction is based on the OpenVoronoi implementation.
2020-06-04 13:50:09 +02:00
Vojtech Bubnik
6f92538c20 BoundingBox support for Lines,
BoundingBox constructor will no more throw for empty vector of points.

GMP allowed for Vojtech's fork of boost::polygon Voronoi implementation.

Added libslic3r tests for boost::polygon Voronoi. All Voronoi issues
ever reported on the Internet are captured by the tests. Two issues
reported (the two test cases) are real issues which may influence
PrusaSlicer negatively, namely

https://github.com/boostorg/polygon/issues/43
2020-05-28 15:53:53 +02:00
bubnikv
26b7dbd6f5 Improved accuracy of ModelVolume matrix store / restore
into the 3MF / AMF.
Improved accuracy of ModelVolume's mesh transform back from Object's
coordinate space to its own coordinate space after reloading
from 3MF / AMF.
2019-12-19 12:27:49 +01:00
bubnikv
9c4dc80057 Fix of the new gyroid infill path planning. Fixes #3226 2019-11-22 18:22:44 +01:00
bubnikv
cf94482731 Fix of Voronoi debug output. 2019-10-23 15:07:41 +02:00
bubnikv
42a858b999 Added test projects for libslic3r and fff_print.
Added test_geometry.cpp from upstream slic3r, thanks @lordofhyphens
Added circle_taubin_newton() for circle center calculation, thanks @lordofhyphens
2019-10-15 09:40:40 +02:00
Enrico Turri
835ee148e5 Fixed conflicts after merging with master 2019-10-09 11:17:48 +02:00
tamasmeszaros
e4247f9856 libslic3r core enhancements
* ClipperUtils extended with ExPolygon to clipper paths conversion and improved PolyTree traversal
* Added ExPolygon constructor with Polygon argument
* Removed BoundingBox warnings on clang
* Removed Geometry warnings on clang
2019-10-01 14:58:37 +02:00
bubnikv
d06831076d WIP: Consolidation of shortest path calculations,
various chaining algorithms are replaced with the improved TSP
algorithm.
2019-09-26 17:30:03 +02:00
Enrico Turri
2dc9949a4c ENABLE_ENHANCED_RELOAD_FROM_DISK set as default 2019-09-23 15:35:49 +02:00
Enrico Turri
74747226f7 ENABLE_ENHANCED_RELOAD_FROM_DISK
1) Modified .zip.amf import/export to save/load volume matrices and source data

2) Incremented .zip.amf version to 3
2019-09-19 12:39:59 +02:00
bubnikv
dc3a0a0ab3 Refactoring of EdgeGrid to accept an segment to segment visitor.
WIP: PolygonTrimmer to trim skirt & brim with polygons stored in EdgeGrid.
2019-08-21 14:52:22 +02:00
bubnikv
9fd0c55eb8 Simplified the "cereal" includes to not clash with Perl includes 2019-07-04 22:09:14 +02:00
bubnikv
3a24fb2f47 Yet another compilation fix. 2019-07-04 20:25:52 +02:00
bubnikv
3e5f9b5a22 Removed some junk templates, which pass compilation on Windows
even if they are invalid.
2019-07-04 19:59:45 +02:00
bubnikv
70c6558a4c Fix of compilation on Linux 2019-07-04 19:48:00 +02:00
bubnikv
d99e932ee8 WIP Undo / Redo: Serialization of the Model / ModelObject / Model instance
using the cereal framework.
2019-06-26 16:29:12 +02:00
Enrico Turri
6b0d75127b #2428
1) Reworked logic for pasting volumes

2) Fixed paste of volumes into different objects

3) Do not apply offset when pasting into the copied object

4) Keep source transformation matrix and relative positions when copy/pasting volumes into another object
2019-06-24 12:26:11 +02:00
Enrico Turri
975ccc4ac1 Tech ENABLE_VOLUMES_CENTERING_FIXES set as default 2019-05-21 09:42:59 +02:00
bubnikv
6526a8fcaf WIP: Transformation of instances in world coordinate space:
Ulocking the "anisotropic" scaling checkbox will bake the transformation
into meshes to allow for scaling in world axes.

Optimized and templated the stl_transform functions, now also available for 3x3 matrices.
The Canvas3D::reload_scene() now maintains selection even if all volumes of an instance changed their IDs.
2019-04-26 17:28:31 +02:00
bubnikv
ca6a5af1dc Fixed rotation of SLA instances in case a rotation in X or Y was applied
to the instances.
2019-04-08 13:35:03 +02:00
bubnikv
086f11df98 Handling of left hand oriented coordinate systems:
is_left_handed() method on transformations and volumes
rendering of GLVolumes in left handed coordinate systems by glFrontFace(GL_CW);
SLA slicing on left hand oriented instances by flipping the mesh for SLAPrintObject in X.
rendering of the SLA cutting plane in left handed systems
resetting the SLA clipping planes on 3D preview invalidation
2019-04-02 13:47:49 +02:00
bubnikv
dc0c58a9c5 Improvement of the initial placement of modifier meshes:
Sphere and Cylinder are scaled to the same volume as Box
Newly entered modifier meshes are rotated parallell to the world coordinates.
If the instance coordinate system is rotated and scaled, it is not possible
to create an unskewed modifier to world transformation. In that case
the best possible transformation is found to minimize least squares error
of the 8 corners of the new modifier mesh bounding box using
Levenberg-Marquardt algorithm.

FIXME:
1) The Levenberg-Marquardt non-linear least squares does not converge
nicely, it may require some tuning.
2) Above all, if 1) is called, then often the skew of the modifier mesh
is so high, that it is likely more useful to display the modifier
with zero rotation and inverse scaling, so that the modifier will be
of correct size, but not parallel to the world coordinates.
2019-02-28 11:20:01 +01:00
bubnikv
bb0cf221bc WIP synchronization of Z rotation of the instances 2019-01-28 08:52:22 +01:00
Enrico Turri
25319113f1 Code cleanup 2019-01-21 11:29:45 +01:00
Enrico Turri
80bae6dd98 1st installment of volumes centering fixes (WIP) 2019-01-18 12:52:09 +01:00