main/src/georegression/struct/so/SpecialOrthogonalOps_F64.java
public static void bestFit( DMatrixRMaj A ) {

		SingularValueDecomposition_F64<DMatrixRMaj> svd = DecompositionFactory_DDRM.svd(true,true,true);

		if( !svd.decompose(A))
			throw new RuntimeException("SVD Failed");

		CommonOps_DDRM.multTransB(svd.getU(null,false),svd.getV(null,false),A);

		// determinant should be +1
		double det = CommonOps_DDRM.det(A);

		if( det < 0 )
			CommonOps_DDRM.scale(-1,A);
	}
public static void bestFit( DMatrixRMaj A ) {

		SingularValueDecomposition_F64<DMatrixRMaj> svd = DecompositionFactory_DDRM.svd(true,true,true);

		if( !svd.decompose(A))
			throw new RuntimeException("SVD Failed");

		CommonOps_DDRM.multTransB(svd.getU(null,false),svd.getV(null,false),A);

		// determinant should be +1
		double det = CommonOps_DDRM.det(A);

		if( det < 0 )
			CommonOps_DDRM.scale(-1,A);
	}
public static void bestFit ( DMatrixRMaj A ) { SingularValueDecomposition_F64 < DMatrixRMaj > svd = DecompositionFactory_DDRM . svd ( true , true , true ) ; if ( ! svd . decompose ( A ) ) throw new RuntimeException ( "SVD Failed" ) ; CommonOps_DDRM . multTransB ( svd . getU ( null , false ) , svd . getV ( null , false ) , A ) ; // determinant should be +1 double det = CommonOps_DDRM . det ( A ) ; if ( det < 0 ) CommonOps_DDRM . scale ( - 1 , A ) ; }
Finds the best fit matrix in SO(3) for the input matrix.

@param A 3x3 matrix. Modified.
Finds the best fit matrix in SO ( 3 ) for the input matrix .