cleaned up some pep8/pyflakes violations
This commit is contained in:
parent
303dd9e8d0
commit
62efeb12b3
2
setup.py
2
setup.py
@ -1,7 +1,7 @@
|
||||
from setuptools import setup, find_packages
|
||||
|
||||
setup(
|
||||
name= 'smbsurf',
|
||||
name='smbsurf',
|
||||
description='',
|
||||
version='0.0',
|
||||
packages=find_packages(),
|
||||
|
@ -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,4 +1,4 @@
|
||||
from surf.geometry import *
|
||||
from surf.geometry import Vertex, Polygon
|
||||
|
||||
def refine(poly):
|
||||
'''
|
||||
|
@ -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))
|
||||
|
@ -1,4 +1,4 @@
|
||||
from surf.util import cube
|
||||
from surf.util import cube
|
||||
from surf.subd import cc
|
||||
polygon = cube()
|
||||
refined_poly = cc.refine(polygon)
|
||||
@ -6,11 +6,11 @@ refined_poly = cc.refine(polygon)
|
||||
print polygon
|
||||
print refined_poly
|
||||
|
||||
#
|
||||
#
|
||||
#
|
||||
#
|
||||
# import pylab
|
||||
# import mpl_toolkits.mplot3d.axes3d as p3
|
||||
#
|
||||
#
|
||||
# fig = pylab.figure()
|
||||
# ax = p3.Axes3D(fig)
|
||||
# for edge in newPolygon.edges:
|
||||
|
@ -1,7 +1,6 @@
|
||||
from __future__ import division
|
||||
from surf.geometry import Vertex
|
||||
|
||||
v1 = Vertex(0.5, 0.25, 1/3.0)
|
||||
v1 = Vertex(0.5, 0.25, 1 / 3.0)
|
||||
v2 = Vertex(1, 1, 1)
|
||||
|
||||
print v1, v2, (v1 + v2) / 2
|
||||
|
Loading…
Reference in New Issue
Block a user