3 from __future__ import print_function
6 signal.signal(signal.SIGINT, signal.SIG_DFL)
20 stl_point_indices = {}
24 print('module MoebiusCore(){ scale(%s) polyhedron(points=[' % nomsize)
25 for p in stl_points: print(p, ',')
27 for t in stl_triangles: print(repr(t), ',')
28 print('],convexity=10); }')
29 print('moebiuscore_nomsize=%s;' % repr(nomsize))
35 ix = stl_point_indices[s]
39 stl_point_indices[s] = ix
42 def stl_triangle(a,b,c):
43 ''' a b c are clockwise from inside '''
44 stl_triangles.append([ stl_point(p) for p in (a,b,c) ])
47 ''' cnrs[0] [1] [3] [2] are clockwise from inside '''
48 stl_triangle(cnrs[0], cnrs[1], cnrs[3])
49 stl_triangle(cnrs[0], cnrs[3], cnrs[2])
52 ''' cnrs[0] [1] [3] [2] are anticlockwise from inside '''
53 stl_triangle(cnrs[0], cnrs[3], cnrs[1])
54 stl_triangle(cnrs[0], cnrs[2], cnrs[3])
56 relthick = thick/(nomsize*2)
58 for v in range(0, nv):
59 for w in range(0, nw):
60 stl_quad([ m.point_offset(v+a, w+b, relthick)
63 stl_rquad([ m.point_offset(v+a, w+b, -relthick)
66 for q, w in ((stl_quad, 0), (stl_rquad, nw)):
67 q([ m.point_offset(v+a, w, b*relthick)