raaargh fix winding order/rotation again in subdivision
This commit is contained in:
parent
78c61ddb22
commit
6ac45773f7
18
cage.py
18
cage.py
@ -46,19 +46,21 @@ class Cage(object):
|
|||||||
def subdivide_deprecated(self):
|
def subdivide_deprecated(self):
|
||||||
# assume self.verts has shape (4,3).
|
# assume self.verts has shape (4,3).
|
||||||
# Midpoints of every segment:
|
# Midpoints of every segment:
|
||||||
mids = (self.verts + numpy.roll(self.verts, 1, axis=0)) / 2
|
mids = (self.verts + numpy.roll(self.verts, -1, axis=0)) / 2
|
||||||
mids_adj = numpy.roll(mids, -1, axis=0)
|
|
||||||
# Centroid:
|
# Centroid:
|
||||||
centroid = numpy.mean(self.verts, axis=0)
|
centroid = numpy.mean(self.verts, axis=0)
|
||||||
# Now, every single new boundary has: one vertex of 'bound', an
|
# Now, every single new boundary has: one vertex of 'bound', an
|
||||||
# adjacent midpoint, a centroid, and the other adjacent midpoint.
|
# adjacent midpoint, a centroid, and the other adjacent midpoint.
|
||||||
cages = [
|
arrs = [
|
||||||
Cage(numpy.array([self.verts[i,:], mids[i,:], centroid, mids_adj[i,:]])[::-1,:],
|
[self.verts[0,:], mids[0,:], centroid, mids[3,:]],
|
||||||
self.splits)
|
[mids[0,:], self.verts[1,:], mids[1,:], centroid],
|
||||||
for i in range(4)
|
[centroid, mids[1,:], self.verts[2,:], mids[2,:]],
|
||||||
|
[mids[3,:], centroid, mids[2,:], self.verts[3,:]],
|
||||||
]
|
]
|
||||||
# TODO: Figure out why I have to have the [::-1,:] above to
|
# The above respects winding order and should not add any rotation.
|
||||||
# fix the winding order
|
# I'm sure it has a pattern I can factor out, but I've not tried
|
||||||
|
# yet.
|
||||||
|
cages = [Cage(numpy.array(a), self.splits) for a in arrs]
|
||||||
return cages
|
return cages
|
||||||
def is_fork(self):
|
def is_fork(self):
|
||||||
return False
|
return False
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user