From cabb79b269e83b982ecc8a88d1c93f4a053efe5c Mon Sep 17 00:00:00 2001 From: willblatt Date: Mon, 19 Mar 2012 09:44:01 -0700 Subject: [PATCH] Fixed bug in CC corner updates. --- geometry.py | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/geometry.py b/geometry.py index 3dfcc5b..e4b2de6 100755 --- a/geometry.py +++ b/geometry.py @@ -301,25 +301,38 @@ class Polygon(object): for vertex in edge.vertices: vertices.append(vertex) + newVertices = [] for vertex in self.vertices: faceVertices = [] edgeMidPoints = [] for edge in vertex.edges: + print edge.midPoint edgeMidPoints.append(edge.midPoint) for face in edge.faces: + print 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))) + # print r p = vertex + # print p 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 - vertex.x = v.x - vertex.y = v.y - vertex.z = v.z + # print v + newVertices.append(v) + for vertex, newVertex in zip(self.vertices, newVertices): + vertex.x = newVertex.x + vertex.y = newVertex.y + vertex.z = newVertex.z # so now what......... # (F + 2R + (n-3) P) / n #