mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-07 06:57:28 -06:00
Move src to cura so we can use the same package for installed and source
Contributes to #41 Contributes to #42
This commit is contained in:
parent
70f5dede95
commit
ae71c309ac
10 changed files with 2 additions and 2 deletions
|
@ -1,35 +0,0 @@
|
|||
# Copyright (c) 2015 Ultimaker B.V.
|
||||
# Cura is released under the terms of the AGPLv3 or higher.
|
||||
|
||||
from UM.Job import Job
|
||||
from UM.Application import Application
|
||||
from UM.Math.Polygon import Polygon
|
||||
|
||||
import numpy
|
||||
|
||||
from . import ConvexHullNode
|
||||
|
||||
class ConvexHullJob(Job):
|
||||
def __init__(self, node):
|
||||
super().__init__()
|
||||
|
||||
self._node = node
|
||||
|
||||
def run(self):
|
||||
if not self._node or not self._node.getMeshData():
|
||||
return
|
||||
|
||||
mesh = self._node.getMeshData()
|
||||
vertexData = mesh.getTransformed(self._node.getWorldTransformation()).getVertices()
|
||||
|
||||
hull = Polygon(numpy.rint(vertexData[:, [0, 2]]).astype(int))
|
||||
|
||||
# First, calculate the normal convex hull around the points
|
||||
hull = hull.getConvexHull()
|
||||
# Then, do a Minkowski hull with a simple 1x1 quad to outset and round the normal convex hull.
|
||||
hull = hull.getMinkowskiHull(Polygon(numpy.array([[-1, -1], [-1, 1], [1, 1], [1, -1]], numpy.float32)))
|
||||
|
||||
hull_node = ConvexHullNode.ConvexHullNode(self._node, hull, Application.getInstance().getController().getScene().getRoot())
|
||||
|
||||
self._node._convex_hull = hull
|
||||
delattr(self._node, "_convex_hull_job")
|
Loading…
Add table
Add a link
Reference in a new issue