private final void getScaleRotate(double scales[], double rots[]) { double[] tmp = new double[9]; // scratch matrix tmp[0] = m00; tmp[1] = m01; tmp[2] = m02; tmp[3] = m10; tmp[4] = m11; tmp[5] = m12; tmp[6] = m20; tmp[7] = m21; tmp[8] = m22; Matrix3d.compute_svd( tmp, scales, rots); return; }
private final void getScaleRotate(double scales[], double rots[]) { double[] tmp = new double[9]; // scratch matrix tmp[0] = m00; tmp[1] = m01; tmp[2] = m02; tmp[3] = m10; tmp[4] = m11; tmp[5] = m12; tmp[6] = m20; tmp[7] = m21; tmp[8] = m22; Matrix3d.compute_svd( tmp, scales, rots); return; }
/** * perform SVD (if necessary to get rotational component */ void getScaleRotate( double[] scales, double[] rot ) { double[] tmp = new double[9]; // scratch matrix tmp[0] = m00; tmp[1] = m01; tmp[2] = m02; tmp[3] = m10; tmp[4] = m11; tmp[5] = m12; tmp[6] = m20; tmp[7] = m21; tmp[8] = m22; Matrix3d.compute_svd(tmp, scales, rot); return; }
/** * perform SVD (if necessary to get rotational component */ final void getScaleRotate(double scales[], double rots[]) { double[] tmp = new double[9]; // scratch matrix tmp[0] = m00; tmp[1] = m01; tmp[2] = m02; tmp[3] = m10; tmp[4] = m11; tmp[5] = m12; tmp[6] = m20; tmp[7] = m21; tmp[8] = m22; compute_svd( tmp, scales, rots); return; }
tmp[8] = m1.m20*m2.m02 + m1.m21*m2.m12 + m1.m22*m2.m22; Matrix3d.compute_svd( tmp, tmp_scale, tmp_rot);
/** * Perform singular value decomposition normalization of matrix m1 * and place the normalized values into this. * @param m1 the matrix values to be normalized */ public final void normalize(Matrix3f m1){ double[] tmp = new double[9]; // scratch matrix double[] tmp_rot = new double[9]; // scratch matrix double[] tmp_scale = new double[3]; // scratch matrix tmp[0] = m1.m00; tmp[1] = m1.m01; tmp[2] = m1.m02; tmp[3] = m1.m10; tmp[4] = m1.m11; tmp[5] = m1.m12; tmp[6] = m1.m20; tmp[7] = m1.m21; tmp[8] = m1.m22; Matrix3d.compute_svd( tmp, tmp_scale, tmp_rot ); this.m00 = (float)(tmp_rot[0]); this.m01 = (float)(tmp_rot[1]); this.m02 = (float)(tmp_rot[2]); this.m10 = (float)(tmp_rot[3]); this.m11 = (float)(tmp_rot[4]); this.m12 = (float)(tmp_rot[5]); this.m20 = (float)(tmp_rot[6]); this.m21 = (float)(tmp_rot[7]); this.m22 = (float)(tmp_rot[8]); }
/** * Perform singular value decomposition normalization of matrix m1 and * place the normalized values into this. * @param m1 Provides the matrix values to be normalized */ public final void normalize(Matrix3d m1){ double[] tmp = new double[9]; // scratch matrix double[] tmp_rot = new double[9]; // scratch matrix double[] tmp_scale = new double[3]; // scratch matrix tmp[0] = m1.m00; tmp[1] = m1.m01; tmp[2] = m1.m02; tmp[3] = m1.m10; tmp[4] = m1.m11; tmp[5] = m1.m12; tmp[6] = m1.m20; tmp[7] = m1.m21; tmp[8] = m1.m22; compute_svd( tmp, tmp_scale, tmp_rot); this.m00 = tmp_rot[0]; this.m01 = tmp_rot[1]; this.m02 = tmp_rot[2]; this.m10 = tmp_rot[3]; this.m11 = tmp_rot[4]; this.m12 = tmp_rot[5]; this.m20 = tmp_rot[6]; this.m21 = tmp_rot[7]; this.m22 = tmp_rot[8]; }
tmp[8] = m1.m20*m2.m02 + m1.m21*m2.m12 + m1.m22*m2.m22; compute_svd( tmp, tmp_scale, tmp_rot);
/** * Multiplies this matrix by matrix m1, does an SVD normalization * of the result, and places the result back into this matrix. * this = SVDnorm(this*m1). * @param m1 the matrix on the right hand side of the multiplication */ public final void mulNormalize(Matrix3f m1){ double[] tmp = new double[9]; // scratch matrix double[] tmp_rot = new double[9]; // scratch matrix double[] tmp_scale = new double[3]; // scratch matrix tmp[0] = this.m00*m1.m00 + this.m01*m1.m10 + this.m02*m1.m20; tmp[1] = this.m00*m1.m01 + this.m01*m1.m11 + this.m02*m1.m21; tmp[2] = this.m00*m1.m02 + this.m01*m1.m12 + this.m02*m1.m22; tmp[3] = this.m10*m1.m00 + this.m11*m1.m10 + this.m12*m1.m20; tmp[4] = this.m10*m1.m01 + this.m11*m1.m11 + this.m12*m1.m21; tmp[5] = this.m10*m1.m02 + this.m11*m1.m12 + this.m12*m1.m22; tmp[6] = this.m20*m1.m00 + this.m21*m1.m10 + this.m22*m1.m20; tmp[7] = this.m20*m1.m01 + this.m21*m1.m11 + this.m22*m1.m21; tmp[8] = this.m20*m1.m02 + this.m21*m1.m12 + this.m22*m1.m22; Matrix3d.compute_svd( tmp, tmp_scale, tmp_rot); this.m00 = (float)(tmp_rot[0]); this.m01 = (float)(tmp_rot[1]); this.m02 = (float)(tmp_rot[2]); this.m10 = (float)(tmp_rot[3]); this.m11 = (float)(tmp_rot[4]); this.m12 = (float)(tmp_rot[5]); this.m20 = (float)(tmp_rot[6]); this.m21 = (float)(tmp_rot[7]); this.m22 = (float)(tmp_rot[8]); }
/** * Multiplies this matrix by matrix m1, does an SVD normalization * of the result, and places the result back into this matrix * this = SVDnorm(this*m1). * @param m1 the matrix on the right hand side of the multiplication */ public final void mulNormalize(Matrix3d m1){ double[] tmp = new double[9]; // scratch matrix double[] tmp_rot = new double[9]; // scratch matrix double[] tmp_scale = new double[3]; // scratch matrix tmp[0] = this.m00*m1.m00 + this.m01*m1.m10 + this.m02*m1.m20; tmp[1] = this.m00*m1.m01 + this.m01*m1.m11 + this.m02*m1.m21; tmp[2] = this.m00*m1.m02 + this.m01*m1.m12 + this.m02*m1.m22; tmp[3] = this.m10*m1.m00 + this.m11*m1.m10 + this.m12*m1.m20; tmp[4] = this.m10*m1.m01 + this.m11*m1.m11 + this.m12*m1.m21; tmp[5] = this.m10*m1.m02 + this.m11*m1.m12 + this.m12*m1.m22; tmp[6] = this.m20*m1.m00 + this.m21*m1.m10 + this.m22*m1.m20; tmp[7] = this.m20*m1.m01 + this.m21*m1.m11 + this.m22*m1.m21; tmp[8] = this.m20*m1.m02 + this.m21*m1.m12 + this.m22*m1.m22; compute_svd( tmp, tmp_scale, tmp_rot); this.m00 = tmp_rot[0]; this.m01 = tmp_rot[1]; this.m02 = tmp_rot[2]; this.m10 = tmp_rot[3]; this.m11 = tmp_rot[4]; this.m12 = tmp_rot[5]; this.m20 = tmp_rot[6]; this.m21 = tmp_rot[7]; this.m22 = tmp_rot[8]; }