a playground adding surface subdivision methods to scipy
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

27 lines
690 B

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='Manually subdivide mesh '
'(first argument) and dump json to stdout')
parser.add_argument('type', choices=('cc', 'butterfly'))
parser.add_argument('refines', type=int)
opt = parser.parse_args()
cube = json.load(open(opt.mesh, 'r'))
p = PolygonMesh(**cube)
if opt.type == 'cc':
refine = cc.refine
refine = butterfly.refine
for i in range(opt.refines):
p = refine(p)