cleaned up some pep8/pyflakes violations

This commit is contained in:
Stephen M. McQuay
2012-03-19 22:18:02 -06:00
parent 303dd9e8d0
commit 62efeb12b3
6 changed files with 18 additions and 12 deletions
+9 -3
View File
@@ -1,6 +1,4 @@
from __future__ import division
import pprint
import json
'''
http://en.wikipedia.org/wiki/Polygon_mesh
@@ -95,9 +93,16 @@ class Vertex(object):
self.y = y
self.z = z
self.edges = []
def __eq__(self, other):
if(self.x == other.x and self.y == other.y and self.z == other.z):
return True
else:
return False
def __repr__(self):
return "<%.2f, %.2f, %.2f>" % (self.x, self.y, self.z)
return "[%.2f, %.2f, %.2f]" % (self.x, self.y, self.z)
def __add__(self, other):
# for now just assume type(other) = Vertex... bad, I know
@@ -115,6 +120,7 @@ class Vertex(object):
def __div__(self, other):
# same assumption as __mult__
other = float(other)
return Vertex(self.x / other, self.y / other, self.z / other)
class Edge(object):
+1 -1
View File
@@ -1,4 +1,4 @@
from surf.geometry import *
from surf.geometry import Vertex, Polygon
def refine(poly):
'''
+2 -1
View File
@@ -1,12 +1,13 @@
from surf.geometry import Vertex, Edge, Face, Polygon
def cube():
v = []
v.append(Vertex(0.0, 1.0, 0.0))
v.append(Vertex(1.0, 1.0, 0.0))
v.append(Vertex(1.0, 0.0, 0.0))
v.append(Vertex(0.0, 0.0, 0.0))
v.append(Vertex(0.0, 1.0, 1.0))
v.append(Vertex(1.0, 1.0, 1.0))
v.append(Vertex(1.0, 0.0, 1.0))