Updated file so that it could pass pep8/pyflakes

- left in borked state
This commit is contained in:
Stephen M. McQuay 2012-05-07 23:19:54 -06:00
parent ef9485f8a6
commit a083621d35
1 changed files with 44 additions and 50 deletions

View File

@ -1,10 +1,5 @@
from surf.geometry import Vertex, Edge, Face, Polygon
from copy import deepcopy
import pprint
from surf.geometry import Vertex, Edge, Polygon
def mid_point(edge):
vertex_objs = [edge.vertices[v_id] for v_id in edge.vertices]
return sum(vertex_objs, Vertex()) / len(self.vertices)
def sub_edges(self):
temp_p = Polygon()
@ -14,6 +9,7 @@ def sub_edges(self):
sub_edges[1].vertices = [self.edge_vertex, self.vertices[1]]
return self.__sub_edges
def centroid(face, poly):
'''
'''
@ -32,12 +28,12 @@ def centroid(face, poly):
return Vertex(poly, x, y, z)
def edge_divide(edge, poly):
'''
Set each edge vertices to be the average of the two neighboring
face vertices and its two original end vertices.
'''
edge_ids = poly.edge_ids_with_parent(edge.id)
if edge_ids:
@ -87,14 +83,17 @@ def edge_divide(edge, poly):
return e0.id, e1.id, edge_vertex.id
def sub_faces(self):
setup_sub_divisions()
return sub_faces()
def interior_edges(self):
setup_sub_divisions()
return self.__interior_edges
def setup_sub_divisions(polygon, face):
'''
v0 ev0 v1
@ -113,13 +112,10 @@ def setup_sub_divisions(polygon, face):
# these need to at least exist so the interior edges have
# something to reference
sub_faces = [Face(polygon) for edge in face.edge_ids]
# sub_faces = [Face(polygon) for edge in face.edge_ids]
# set up empty edge objects to be filled below
interior_edges = [Edge(polygon) for edge in face.edge_ids]
# interior_edges = [Edge(polygon) for edge in face.edge_ids]
# # each interior edge connects the exterior edge vertex (mid-point)
# # to the faceVertex (centroid)
@ -176,6 +172,7 @@ def setup_sub_divisions(polygon, face):
# self.__sub_faces[index])
pass
def subdivide_face(poly, face):
# '''
# '''
@ -188,6 +185,7 @@ def subdivide_face(poly, face):
# x, y, z = edge_mid_vertex(edge)
pass
def refine(poly):
'''
For each face, add a face vertex
@ -234,7 +232,7 @@ def refine(poly):
centroid_to_edge.vertex_ids = [edge_v_id, start_centroid.id]
# set the new edge's winged_edge references
centroid_to_edge.edge_ids = poly.edges ==> get edge by id not yet implemented... edge_v_id.edges
# centroid_to_edge.edge_ids = poly.edges ==> get edge by id not yet implemented... edge_v_id.edges
# set the edge vertex edge references
edge_v_id.edges.append(centroid_to_edge.id)
@ -247,12 +245,8 @@ def refine(poly):
# need to get an adjacent edge, based on the the shared vertex of the
# original polygon... centroid to edge_vertex to shared point...
# start_face.neighbors
# f = sum(list(
# set(face_vertices)), Vertex()) / len(list(set(face_vertices)))
# r = sum(list(