def _make_transform_card(fro, to, r_lpa, r_nasion, r_rpa):
 diff_1 = (r_nasion - r_lpa)
 ex = (r_rpa - r_lpa)
 alpha = (np.dot(diff_1, ex) / np.dot(ex, ex))
 ex /= np.sqrt(np.sum((ex * ex)))
 trans = np.eye(4)
 move = (((1.0 - alpha) * r_lpa) + (alpha * r_rpa))
 trans[:3, 3] = move
 trans[:3, 0] = ex
 ey = (r_nasion - move)
 ey /= np.sqrt(np.sum((ey * ey)))
 trans[:3, 1] = ey
 trans[:3, 2] = np.cross(ex, ey)
 return Transform(fro, to, trans)

def _make_transform_card ( fro , to , r_lpa , r_nasion , r_rpa ) : diff_1 = ( r_nasion - r_lpa ) ex = ( r_rpa - r_lpa ) alpha = ( np . dot ( diff_1 , ex ) / np . dot ( ex , ex ) ) ex /= np . sqrt ( np . sum ( ( ex * ex ) ) ) trans = np . eye ( 4 ) move = ( ( ( 1.0 - alpha ) * r_lpa ) + ( alpha * r_rpa ) ) trans [ : 3 , 3 ] = move trans [ : 3 , 0 ] = ex ey = ( r_nasion - move ) ey /= np . sqrt ( np . sum ( ( ey * ey ) ) ) trans [ : 3 , 1 ] = ey trans [ : 3 , 2 ] = np . cross ( ex , ey ) return Transform ( fro , to , trans )
make a transform from cardinal landmarks .