-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTransformation.py
55 lines (43 loc) · 1.81 KB
/
Transformation.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
import vedo as v
import shapely
from shapely.geometry import Point, Polygon, LineString, GeometryCollection
class Transformation:
def __init__(self, bounds, prio=0, addResidual=True, name=None):
# debug("Transformation created")
self.boundaries = bounds
self.prio = prio
self.addResidual = addResidual
self.isResidual = False
# self.color = None
self.color = [255, 255, 0, 255]
# self.points = []
self.meshes = []
self.mel = []
self.scope = None
self.parent = None
self.name = name
self.transformWholeMesh = False
def __str__(self):
print("Transformation")
def getOutline(self):
x = self.boundaries.exterior.coords.xy[0][:-1]
y = self.boundaries.exterior.coords.xy[1][:-1]
z = [self.parent.zmax] * len(x)
#pts = np.zeros((len(x), 3)) # zip(x, y, z)
pts = list(zip(x, y, z))
return pts
def get_preprocessed_mesh(self, layerId):
print(" Transformation {}\n -> layer {}/{}".format(self, layerId, len(self.mel)))
return self.meshes[layerId].clone().subdivide(1, 2, self.mel[layerId])
def getArea(self):
return self.getOutline().triangulate().lw(0)
def getAffectedPoints(self):
raise NotImplementedError("Please implement the function in a new class.")
def getMatrixAt(self, pt):
raise NotImplementedError("Please implement the function in a new class.")
def isInScope(self, point):
raise NotImplementedError("Please implement the function in a new class.")
def getResidualTransformation(self):
raise NotImplementedError("Please implement the function in a new class.")
def getBorderline(self):
raise NotImplementedError("Please implement the function in a new class.")