public static void inverse ( Transformation3D src , Transformation3D result ) { double det = src . xx * ( src . yy * src . zz - src . zy * src . yz ) - src . yx * ( src . xy * src . zz - src . zy * src . xz ) + src . zx * ( src . xy * src . yz - src . yy * src . xz ) ; if ( det != 0 ) { double xx , yx , zx ; double xy , yy , zy ; double xz , yz , zz ; double xd , yd , zd ; double det_1 = 1.0 / det ; xx = ( src . yy * src . zz - src . zy * src . yz ) * det_1 ; xy = - ( src . xy * src . zz - src . zy * src . xz ) * det_1 ; xz = ( src . xy * src . yz - src . yy * src . xz ) * det_1 ; yx = - ( src . yx * src . zz - src . yz * src . zx ) * det_1 ; yy = ( src . xx * src . zz - src . zx * src . xz ) * det_1 ; yz = - ( src . xx * src . yz - src . yx * src . xz ) * det_1 ; zx = ( src . yx * src . zy - src . zx * src . yy ) * det_1 ; zy = - ( src . xx * src . zy - src . zx * src . xy ) * det_1 ; zz = ( src . xx * src . yy - src . yx * src . xy ) * det_1 ; xd = - ( src . xd * xx + src . yd * xy + src . zd * xz ) ; yd = - ( src . xd * yx + src . yd * yy + src . zd * yz ) ; zd = - ( src . xd * zx + src . yd * zy + src . zd * zz ) ; result . xx = xx ; result . yx = yx ; result . zx = zx ; result . xy = xy ; result . yy = yy ; result . zy = zy ; result . xz = xz ; result . yz = yz ; result . zz = zz ; result . xd = xd ; result . yd = yd ; result . zd = zd ; } else { throw new GeometryException ( "math singularity" ) ; } }
Calculates the Inverse transformation .