INNER CODE UNIT · Python
nstr_double
TheOpenSpaceProgram/osp-magnum · scripts/icosahedron_tables.py:35
def nstr_double(value):
return nstr_fixed(value, 16)
def nstr_float(value):
return nstr_fixed(value, 9) + "f"
def mid(a, b):
return (0.5*(a[0]+b[0]), 0.5*(a[1]+b[1]), 0.5*(a[2]+b[2]))
def mag(a):
return sqrt(a[0]*a[0] + a[1]*a[1] + a[2]*a[2])
def norm(a):
m = mag(a)
return (a[0]/m, a[1]/m, a[2]/m)
def distance(a, b):
return mag((b[0]-a[0], b[1]-a[1], b[2]-a[2]))