Browse Source

Stubbed out subd.butterfly and added testing script

master
Stephen M. McQuay 10 years ago
parent
commit
2355deec9f
  1. 24
      bin/iterate.py
  2. 2
      surf/__init__.py
  3. 5
      surf/geometry.py
  4. 7
      surf/subd/__init__.py
  5. 2
      surf/subd/butterfly.py
  6. 11
      surf/subd/cc.py

24
bin/iterate.py

@ -0,0 +1,24 @@
import argparse
import json
from surf.geometry import PolygonMesh
from surf.subd import cc
from surf.subd import butterfly
if __name__ == '__main__':
parser = argparse.ArgumentParser(description='Prune orphan PCDs from couchdb')
parser.add_argument('type', choices=('cc', 'butterfly'))
parser.add_argument('mesh')
opt = parser.parse_args()
cube = json.load(open(opt.mesh, 'r'))
p = PolygonMesh(**cube)
if opt.type == 'cc':
refine = cc.refine
else:
refine = butterfly.refine
q = refine(p)
print(q)

2
surf/__init__.py

@ -1,6 +1,8 @@
from .geometry import Vertex, PolygonMesh
from . import subd
__all__ = [
Vertex.__name__,
PolygonMesh.__name__,
'subd',
]

5
surf/geometry.py

@ -18,6 +18,11 @@ We have chosen to use a winged-edge style mesh for our purpopses.
'''
__all__ = [
'Vertex',
'PolygonMesh',
]
def cross(a, b):
i = a.y * b.z - a.z * b.y

7
surf/subd/__init__.py

@ -0,0 +1,7 @@
from . import cc, butterfly
__all__ = [
cc.__name__,
butterfly.__name__,
]

2
surf/subd/butterfly.py

@ -0,0 +1,2 @@
def refine(mesh):
pass

11
surf/subd/cc.py

@ -109,14 +109,3 @@ def refine(mesh):
new_faces.append([fvid, common_ids[0], connected_vid, common_ids[1]])
return PolygonMesh(vertices=new_vertices, edges=new_edges, faces=new_faces)
if __name__ == '__main__':
import sys
import json
from surf.subd.cc import refine
input_file_name = sys.argv[1]
cube = json.load(open(input_file_name, 'r'))
p = PolygonMesh(**cube)
q = refine(p)
print q

Loading…
Cancel
Save