if (bests[best_key] is None or
goodness(prospective) > goodness(bests[best_key])):
bests[best_key] = prospective
- def print_bests(name, info_index):
+ def print_best_list(name, l):
print('moebius_pin_%s=[' % name)
- for b in bests: print(repr(list(b[info_index])),',')
+ for i in l: print(repr(list(i)),',')
print('];')
+ def print_bests(name, info_index):
+ print_best_list(name, [b[info_index] for b in bests])
print_bests('locns', 0)
print_bests('normals', 1)
+ upwardses = []
+ alongs = []
+ matrices = []
+ for b in bests:
+ along = unit_v(np.cross(b[1], unit_z))
+ upwards = np.cross(b[1], along)
+ matrix = [ b[1],
+ upwards,
+ along ]
+ print('initial', matrix, file=sys.stderr)
+ matrix = np.concatenate((matrix, [[0,0,0]]))
+ print('concatd', matrix, file=sys.stderr)
+ matrix = np.array(matrix).T
+ print('transposed', matrix, file=sys.stderr)
+ matrix = np.concatenate((matrix, [[0,0,0,1]]))
+ print('concat2', matrix, file=sys.stderr)
+ matrix = [ list(row) for row in matrix ]
+ print('listed', matrix, file=sys.stderr)
+ alongs .append(along)
+ upwardses.append(upwards)
+ matrices. append(matrix)
+ print_best_list('upwardses',upwardses)
+ print_best_list('alongs', alongs)
+ print_best_list('matrix', matrices)
make_moebius('MoebiusCore')
make_pinlocations()