main/src/georegression/geometry/GeometryMath_F64.java
public static <T extends GeoTuple3D_F64> T multTran( DMatrixRMaj M, T pt, T mod ) {
		if( M.numRows != 3 || M.numCols != 3 )
			throw new IllegalArgumentException( "Rotation matrices are 3 by 3." );

		if( mod == null ) {
			mod = (T) pt.createNewInstance();
		}

		double x = pt.x;
		double y = pt.y;
		double z = pt.z;

		mod.x = (double) ( M.unsafe_get( 0, 0 ) * x + M.unsafe_get( 1, 0 ) * y + M.unsafe_get( 2, 0 ) * z );
		mod.y = (double) ( M.unsafe_get( 0, 1 ) * x + M.unsafe_get( 1, 1 ) * y + M.unsafe_get( 2, 1 ) * z );
		mod.z = (double) ( M.unsafe_get( 0, 2 ) * x + M.unsafe_get( 1, 2 ) * y + M.unsafe_get( 2, 2 ) * z );

		return (T) mod;
	}
public static <T extends GeoTuple3D_F64> T multTran( DMatrixRMaj M, T pt, T mod ) {
		if( M.numRows != 3 || M.numCols != 3 )
			throw new IllegalArgumentException( "Rotation matrices are 3 by 3." );

		if( mod == null ) {
			mod = (T) pt.createNewInstance();
		}

		double x = pt.x;
		double y = pt.y;
		double z = pt.z;

		mod.x = (double) ( M.unsafe_get( 0, 0 ) * x + M.unsafe_get( 1, 0 ) * y + M.unsafe_get( 2, 0 ) * z );
		mod.y = (double) ( M.unsafe_get( 0, 1 ) * x + M.unsafe_get( 1, 1 ) * y + M.unsafe_get( 2, 1 ) * z );
		mod.z = (double) ( M.unsafe_get( 0, 2 ) * x + M.unsafe_get( 1, 2 ) * y + M.unsafe_get( 2, 2 ) * z );

		return (T) mod;
	}
public static < T extends GeoTuple3D_F64 > T multTran ( DMatrixRMaj M , T pt , T mod ) { if ( M . numRows != 3 || M . numCols != 3 ) throw new IllegalArgumentException ( "Rotation matrices are 3 by 3." ) ; if ( mod == null ) { mod = ( T ) pt . createNewInstance ( ) ; } double x = pt . x ; double y = pt . y ; double z = pt . z ; mod . x = ( double ) ( M . unsafe_get ( 0 , 0 ) * x + M . unsafe_get ( 1 , 0 ) * y + M . unsafe_get ( 2 , 0 ) * z ) ; mod . y = ( double ) ( M . unsafe_get ( 0 , 1 ) * x + M . unsafe_get ( 1 , 1 ) * y + M . unsafe_get ( 2 , 1 ) * z ) ; mod . z = ( double ) ( M . unsafe_get ( 0 , 2 ) * x + M . unsafe_get ( 1 , 2 ) * y + M . unsafe_get ( 2 , 2 ) * z ) ; return ( T ) mod ; }
mod = M<sup>T</sup>*pt.  Both pt and mod can be the same instance.
mod = M<sup > T< / sup > * pt . Both pt and mod can be the same instance .