mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-25 15:44:04 -06:00
Expand convex hull by horizontal expansion
The getSetting call doesn't seem to work at the moment, but the rest of the routine works if I replace the getSetting call with an actual value. Contributes to issue CURA-2407.
This commit is contained in:
parent
dc80d50eb5
commit
6affb80189
1 changed files with 10 additions and 3 deletions
|
@ -199,9 +199,16 @@ class ConvexHullDecorator(SceneNodeDecorator):
|
||||||
# First, calculate the normal convex hull around the points
|
# First, calculate the normal convex hull around the points
|
||||||
convex_hull = hull.getConvexHull()
|
convex_hull = hull.getConvexHull()
|
||||||
|
|
||||||
# Then, do a Minkowski hull with a simple 1x1 quad to outset and round the normal convex hull.
|
#Then, offset the convex hull with the horizontal expansion value, since that is always added to the mesh.
|
||||||
# This is done because of rounding errors.
|
#Use a minimum of 0.5mm to outset and round the normal convex hull if there is no horizontal expansion, because of edge cases.
|
||||||
rounded_hull = convex_hull.getMinkowskiHull(Polygon(numpy.array([[-0.5, -0.5], [-0.5, 0.5], [0.5, 0.5], [0.5, -0.5]], numpy.float32)))
|
horizontal_expansion = max(0.5, self._getSettingProperty("xy_offset", "value"))
|
||||||
|
expansion_polygon = Polygon(numpy.array([
|
||||||
|
[-horizontal_expansion, -horizontal_expansion],
|
||||||
|
[-horizontal_expansion, horizontal_expansion],
|
||||||
|
[horizontal_expansion, horizontal_expansion],
|
||||||
|
[horizontal_expansion, -horizontal_expansion]
|
||||||
|
], numpy.float32))
|
||||||
|
rounded_hull = convex_hull.getMinkowskiHull(expansion_polygon)
|
||||||
|
|
||||||
# Store the result in the cache
|
# Store the result in the cache
|
||||||
self._2d_convex_hull_mesh = mesh
|
self._2d_convex_hull_mesh = mesh
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue