def calc_circumcenters(tetrahedrons):
 num = tetrahedrons.shape[0]
 a = np.concatenate((tetrahedrons, np.ones((num, 4, 1))), axis=2)
 sums = np.sum((tetrahedrons ** 2), axis=2)
 d = np.concatenate((sums[:, :, np.newaxis], a), axis=2)
 dx = np.delete(d, 1, axis=2)
 dy = np.delete(d, 2, axis=2)
 dz = np.delete(d, 3, axis=2)
 dx = np.linalg.det(dx)
 dy = (- np.linalg.det(dy))
 dz = np.linalg.det(dz)
 a = np.linalg.det(a)
 nominator = np.vstack((dx, dy, dz))
 denominator = (2 * a)
 return (nominator / denominator).T

def calc_circumcenters ( tetrahedrons ) : num = tetrahedrons . shape [ 0 ] a = np . concatenate ( ( tetrahedrons , np . ones ( ( num , 4 , 1 ) ) ) , axis = 2 ) sums = np . sum ( ( tetrahedrons ** 2 ) , axis = 2 ) d = np . concatenate ( ( sums [ : , : , np . newaxis ] , a ) , axis = 2 ) dx = np . delete ( d , 1 , axis = 2 ) dy = np . delete ( d , 2 , axis = 2 ) dz = np . delete ( d , 3 , axis = 2 ) dx = np . linalg . det ( dx ) dy = ( - np . linalg . det ( dy ) ) dz = np . linalg . det ( dz ) a = np . linalg . det ( a ) nominator = np . vstack ( ( dx , dy , dz ) ) denominator = ( 2 * a ) return ( nominator / denominator ) . T
calculates the cirumcenters of the circumspheres of tetrahedrons .