nomsize = 20
thick = 1.0
+sliceat = 1.675;
+
nv = 80
nw = 80
for b in (-1, +1) ])
so.writeout(objname, nomsize)
-make_moebius('MoebiusCore')
+def make_pinlocations():
+ bests = [ None, None ] # bests[ y>=0 ] = (locn, normal)
+ def goodness(info):
+ # we find the one with biggest Z (actually, the least -ve)
+ return (
+ 0 * np.linalg.norm(info[0][0:2])
+ -abs(info[1][2])
+ )
+ return abs(info[1][1])
+
+ for v in range(0, nv):
+ for w in range(0, nw):
+ core_quad = [ m.point(v+a, w+b)
+ for a in (1, 0)
+ for b in (1, 0) ]
+ for p,q in [ (core_quad[i], core_quad[(i+1) % 4])
+ for i in range(0,4) ]:
+ normal = (m.point_offset(v, w, 0.5) - core_quad[0] +
+ m.point_offset(v+1,w+1, 0.5) - core_quad[3]);
+ if normal[2] > 0: # inwards, make outwards
+ normal = -normal
+
+ #print(repr((p,q)), file=sys.stderr)
+ if (p[2] > -sliceat) == (q[2] > -sliceat): continue
+
+ lincomb = (-sliceat - p[2]) / (q[2] - p[2])
+ here = p * (1-lincomb) + q * lincomb;
+ best_key = here[1] >= 0
+ prospective = (here,normal)
+ if (bests[best_key] is None or
+ goodness(prospective) > goodness(bests[best_key])):
+ bests[best_key] = prospective
+ def print_bests(name, info_index):
+ print('moebius_pin_%s=[' % name)
+ for b in bests: print(repr(list(b[info_index])),',')
+ print('];')
+ print_bests('locns', 0)
+ print_bests('normals', 1)
+
+make_moebius('MoebiusCore')
+make_pinlocations()
print('moebiuscore_nomsize=%s;' % repr(nomsize))