Refactored into modules and test scripts.

This commit is contained in:
Stephen M. McQuay
2012-03-19 20:38:40 -06:00
parent 6a69a99706
commit 2f4d648f55
7 changed files with 475 additions and 464 deletions
+24
View File
@@ -0,0 +1,24 @@
from surf.util import cube
from surf.subd import cc
polygon = cube()
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:
# xs = [vertex.x for vertex in edge.vertices]
# ys = [vertex.y for vertex in edge.vertices]
# zs = [vertex.z for vertex in edge.vertices]
# ax.plot_wireframe(xs, ys, zs)
# ax.set_xlabel('X')
# ax.set_ylabel('Y')
# ax.set_zlabel('Z')
# pylab.show()
+11
View File
@@ -0,0 +1,11 @@
from __future__ import division
from surf.geometry import Vertex
v1 = Vertex(0.5, 0.25, 1/3.0)
v2 = Vertex(1, 1, 1)
print v1, v2, (v1 + v2) / 2
print v1, v2, (v1 + v2) / 2.0
v = sum((v1, v2), Vertex()) / len((v1, v2))
print v, type(v)