This commit is contained in:
Stephen M. McQuay 2012-03-19 10:45:13 -06:00
commit 6a69a99706

View File

@ -301,25 +301,38 @@ class Polygon(object):
for vertex in edge.vertices: for vertex in edge.vertices:
vertices.append(vertex) vertices.append(vertex)
newVertices = []
for vertex in self.vertices: for vertex in self.vertices:
faceVertices = [] faceVertices = []
edgeMidPoints = [] edgeMidPoints = []
for edge in vertex.edges: for edge in vertex.edges:
print edge.midPoint
edgeMidPoints.append(edge.midPoint) edgeMidPoints.append(edge.midPoint)
for face in edge.faces: for face in edge.faces:
print face.centroid
faceVertices.append(face.centroid) faceVertices.append(face.centroid)
f = sum(list(set(faceVertices)), Vertex())/len(list(set(faceVertices))) print edgeMidPoints
print vertex
print faceVertices
f = sum(list(set(faceVertices)), Vertex())/len(list(set(faceVertices)))
# print f
r = sum(list(set(edgeMidPoints)), Vertex())/len(list(set(edgeMidPoints))) r = sum(list(set(edgeMidPoints)), Vertex())/len(list(set(edgeMidPoints)))
# print r
p = vertex p = vertex
# print p
n = len(vertex.edges) n = len(vertex.edges)
v = (f + (2.0 * r) + (n - 3.0) * p) / n # print n
v = (f + 2.0 * r + (n - 3.0) * p) / n
# print v # print v
vertex.x = v.x # print v
vertex.y = v.y newVertices.append(v)
vertex.z = v.z
for vertex, newVertex in zip(self.vertices, newVertices):
vertex.x = newVertex.x
vertex.y = newVertex.y
vertex.z = newVertex.z
# so now what......... # so now what.........
# (F + 2R + (n-3) P) / n # (F + 2R + (n-3) P) / n
# #