Store the disallowed areas as polygons and use those to test for intersection

This prevents issues when trying to print larger things

Contributes to Asana issue 37107676459484
This commit is contained in:
Arjen Hiemstra 2015-06-25 13:54:36 +02:00
parent 8ca0e8eef2
commit 886dac5781
2 changed files with 12 additions and 16 deletions

View file

@ -94,14 +94,19 @@ class PlatformPhysics:
move_vector.setX(overlap[0] * 1.1)
move_vector.setZ(overlap[1] * 1.1)
if hasattr(node, "_convex_hull"):
# Check for collisions between disallowed areas and the object
for area in self._build_volume.getDisallowedAreas():
overlap = node._convex_hull.intersectsPolygon(area)
if overlap is None:
continue
node._outside_buildarea = True
if move_vector != Vector():
op = PlatformPhysicsOperation.PlatformPhysicsOperation(node, move_vector)
op.push()
if node.getBoundingBox().intersectsBox(self._build_volume.getBoundingBox()) == AxisAlignedBox.IntersectionResult.FullIntersection:
op = ScaleToBoundsOperation(node, self._build_volume.getBoundingBox())
op.push()
def _onToolOperationStarted(self, tool):
self._enabled = False