File tree 2 files changed +8
-0
lines changed
2 files changed +8
-0
lines changed Original file line number Diff line number Diff line change 15
15
# parse command line
16
16
help = 'one of: ' + ', ' .join (formats )
17
17
parser = OptionParser ('usage: [options] input_file output_file' )
18
+ parser .add_option ('--scale' , dest = 'scale' , help = 'scales the model' )
18
19
parser .add_option ('--center' , action = 'store_true' , help = 'centers the model above the origin' )
19
20
parser .add_option ('--compute_normals' , action = 'store_true' , help = 'computes smoothed normals' )
20
21
parser .add_option ('--in' , dest = 'input_format' , help = help )
52
53
if options .compute_normals :
53
54
print 'computing normals'
54
55
model .compute_normals ()
56
+ if options .scale :
57
+ print 'scaling model'
58
+ model .scale (float (options .scale ))
55
59
56
60
# save model
57
61
out_file = open (out_path , 'wb' )
Original file line number Diff line number Diff line change @@ -74,3 +74,7 @@ def compute_normals(self):
74
74
c .normal += n
75
75
for v in self .vertices :
76
76
v .normal = v .normal .unit ()
77
+
78
+ def scale (self , scale ):
79
+ for v in self .vertices :
80
+ v .pos = v .pos * scale
You can’t perform that action at this time.
0 commit comments