public Quaternion fromAxes ( IVector3 nx , IVector3 ny , IVector3 nz ) { double nxx = nx . x ( ) , nyy = ny . y ( ) , nzz = nz . z ( ) ; double x2 = ( 1f + nxx - nyy - nzz ) / 4f ; double y2 = ( 1f - nxx + nyy - nzz ) / 4f ; double z2 = ( 1f - nxx - nyy + nzz ) / 4f ; double w2 = ( 1f - x2 - y2 - z2 ) ; return set ( Math . sqrt ( x2 ) * ( ny . z ( ) >= nz . y ( ) ? + 1f : - 1f ) , Math . sqrt ( y2 ) * ( nz . x ( ) >= nx . z ( ) ? + 1f : - 1f ) , Math . sqrt ( z2 ) * ( nx . y ( ) >= ny . x ( ) ? + 1f : - 1f ) , Math . sqrt ( w2 ) ) ; }
Sets this quaternion to one that rotates onto the given unit axes .