if (((t1.dirtyBits & CONGRUENT_BIT) == 0) && ((t1.type & CONGRUENT) != 0) && ((t2.dirtyBits & CONGRUENT_BIT) == 0) && ((t2.type & CONGRUENT) != 0)) { type = t1.type & t2.type; dirtyBits = t1.dirtyBits | t2.dirtyBits | CLASSIFY_BIT | ROTSCALESVD_DIRTY | RIGID_BIT; } else { if (aff) { dirtyBits = ORTHO_BIT | CONGRUENT_BIT | RIGID_BIT | CLASSIFY_BIT | ROTSCALESVD_DIRTY; } else { dirtyBits = CLASSIFY_ALL_DIRTY | ROTSCALESVD_DIRTY; } }  if (autoNormalize) { normalize(); }
dirtyBits = CLASSIFY_ALL_DIRTY | ROTSCALESVD_DIRTY;
    public final void mul(Transform3D t1, Transform3D t2) {	boolean aff = false;	if ((this != t1)  &&  (this != t2)) {	    if (t2.isAffine()) {		mat[0] = t1.mat[0]*t2.mat[0] + t1.mat[1]*t2.mat[4] + t1.mat[2]*t2.mat[8];		mat[1] = t1.mat[0]*t2.mat[1] + t1.mat[1]*t2.mat[5] + t1.mat[2]*t2.mat[9];		mat[2] = t1.mat[0]*t2.mat[2] + t1.mat[1]*t2.mat[6] + t1.mat[2]*t2.mat[10];		mat[3] = t1.mat[0]*t2.mat[3] + t1.mat[1]*t2.mat[7] +                         t1.mat[2]*t2.mat[11] + t1.mat[3];		mat[4] = t1.mat[4]*t2.mat[0] + t1.mat[5]*t2.mat[4] + t1.mat[6]*t2.mat[8];		mat[5] = t1.mat[4]*t2.mat[1] + t1.mat[5]*t2.mat[5] + t1.mat[6]*t2.mat[9];	        mat[6] = t1.mat[4]*t2.mat[2] + t1.mat[5]*t2.mat[6] + t1.mat[6]*t2.mat[10];	        mat[7] = t1.mat[4]*t2.mat[3] + t1.mat[5]*t2.mat[7] +                         t1.mat[6]*t2.mat[11] + t1.mat[7];		mat[8] = t1.mat[8]*t2.mat[0] + t1.mat[9]*t2.mat[4] + t1.mat[10]*t2.mat[8];	        mat[9] = t1.mat[8]*t2.mat[1] + t1.mat[9]*t2.mat[5] + t1.mat[10]*t2.mat[9];		mat[10] = t1.mat[8]*t2.mat[2] + t1.mat[9]*t2.mat[6] + t1.mat[10]*t2.mat[10];	        mat[11] = t1.mat[8]*t2.mat[3] + t1.mat[9]*t2.mat[7] +                          t1.mat[10]*t2.mat[11] + t1.mat[11];		if (t1.isAffine()) {		    aff = true;		    mat[12] =  mat[13] = mat[14] = 0;		    mat[15] = 1;		} else {		    mat[12] = t1.mat[12]*t2.mat[0] + t1.mat[13]*t2.mat[4] +			      t1.mat[14]*t2.mat[8];		    mat[13] = t1.mat[12]*t2.mat[1] + t1.mat[13]*t2.mat[5] +		              t1.mat[14]*t2.mat[9];		    mat[14] = t1.mat[12]*t2.mat[2] + t1.mat[13]*t2.mat[6] +		              t1.mat[14]*t2.mat[10];		    mat[15] = t1.mat[12]*t2.mat[3] + t1.mat[13]*t2.mat[7] +			      t1.mat[14]*t2.mat[11] + t1.mat[15];		}	    } else {		mat[0] = t1.mat[0]*t2.mat[0] + t1.mat[1]*t2.mat[4] +		         t1.mat[2]*t2.mat[8] + t1.mat[3]*t2.mat[12];		mat[1] = t1.mat[0]*t2.mat[1] + t1.mat[1]*t2.mat[5] +		         t1.mat[2]*t2.mat[9] + t1.mat[3]*t2.mat[13];		mat[2] = t1.mat[0]*t2.mat[2] + t1.mat[1]*t2.mat[6] +		         t1.mat[2]*t2.mat[10] + t1.mat[3]*t2.mat[14];		mat[3] = t1.mat[0]*t2.mat[3] + t1.mat[1]*t2.mat[7] +		         t1.mat[2]*t2.mat[11] + t1.mat[3]*t2.mat[15];		mat[4] = t1.mat[4]*t2.mat[0] + t1.mat[5]*t2.mat[4] +		         t1.mat[6]*t2.mat[8] + t1.mat[7]*t2.mat[12];		mat[5] = t1.mat[4]*t2.mat[1] + t1.mat[5]*t2.mat[5] +		         t1.mat[6]*t2.mat[9] + t1.mat[7]*t2.mat[13];		mat[6] = t1.mat[4]*t2.mat[2] + t1.mat[5]*t2.mat[6] +		         t1.mat[6]*t2.mat[10] + t1.mat[7]*t2.mat[14];		mat[7] = t1.mat[4]*t2.mat[3] + t1.mat[5]*t2.mat[7] +		         t1.mat[6]*t2.mat[11] + t1.mat[7]*t2.mat[15];		mat[8] = t1.mat[8]*t2.mat[0] + t1.mat[9]*t2.mat[4] +		         t1.mat[10]*t2.mat[8] + t1.mat[11]*t2.mat[12];		mat[9] = t1.mat[8]*t2.mat[1] + t1.mat[9]*t2.mat[5] +		         t1.mat[10]*t2.mat[9] + t1.mat[11]*t2.mat[13];		mat[10] = t1.mat[8]*t2.mat[2] + t1.mat[9]*t2.mat[6] +		          t1.mat[10]*t2.mat[10] + t1.mat[11]*t2.mat[14];		mat[11] = t1.mat[8]*t2.mat[3] + t1.mat[9]*t2.mat[7] +		          t1.mat[10]*t2.mat[11] + t1.mat[11]*t2.mat[15];		if (t1.isAffine()) {		    mat[12] = t2.mat[12];		    mat[13] = t2.mat[13];		    mat[14] = t2.mat[14];		    mat[15] = t2.mat[15];		} else {		    mat[12] = t1.mat[12]*t2.mat[0] + t1.mat[13]*t2.mat[4] +		              t1.mat[14]*t2.mat[8] + t1.mat[15]*t2.mat[12];		    mat[13] = t1.mat[12]*t2.mat[1] + t1.mat[13]*t2.mat[5] +		              t1.mat[14]*t2.mat[9] + t1.mat[15]*t2.mat[13];		    mat[14] = t1.mat[12]*t2.mat[2] + t1.mat[13]*t2.mat[6] +			      t1.mat[14]*t2.mat[10] + t1.mat[15]*t2.mat[14];		    mat[15] = t1.mat[12]*t2.mat[3] + t1.mat[13]*t2.mat[7] +		              t1.mat[14]*t2.mat[11] + t1.mat[15]*t2.mat[15];		}	    }	} else {	    double tmp0, tmp1, tmp2, tmp3;	    double tmp4, tmp5, tmp6, tmp7;	    double tmp8, tmp9, tmp10, tmp11;	    if (t2.isAffine()) {		tmp0 = t1.mat[0]*t2.mat[0] + t1.mat[1]*t2.mat[4] + t1.mat[2]*t2.mat[8];		tmp1 = t1.mat[0]*t2.mat[1] + t1.mat[1]*t2.mat[5] + t1.mat[2]*t2.mat[9];		tmp2 = t1.mat[0]*t2.mat[2] + t1.mat[1]*t2.mat[6] + t1.mat[2]*t2.mat[10];		tmp3 = t1.mat[0]*t2.mat[3] + t1.mat[1]*t2.mat[7] +		       t1.mat[2]*t2.mat[11] + t1.mat[3];		tmp4 = t1.mat[4]*t2.mat[0] + t1.mat[5]*t2.mat[4] + t1.mat[6]*t2.mat[8];		tmp5 = t1.mat[4]*t2.mat[1] + t1.mat[5]*t2.mat[5] + t1.mat[6]*t2.mat[9];	        tmp6 = t1.mat[4]*t2.mat[2] + t1.mat[5]*t2.mat[6] + t1.mat[6]*t2.mat[10];	        tmp7 = t1.mat[4]*t2.mat[3] + t1.mat[5]*t2.mat[7] +                       t1.mat[6]*t2.mat[11] + t1.mat[7];		tmp8 = t1.mat[8]*t2.mat[0] + t1.mat[9]*t2.mat[4] + t1.mat[10]*t2.mat[8];	        tmp9 = t1.mat[8]*t2.mat[1] + t1.mat[9]*t2.mat[5] + t1.mat[10]*t2.mat[9];		tmp10 = t1.mat[8]*t2.mat[2] + t1.mat[9]*t2.mat[6] + t1.mat[10]*t2.mat[10];	        tmp11 = t1.mat[8]*t2.mat[3] + t1.mat[9]*t2.mat[7] +                        t1.mat[10]*t2.mat[11] + t1.mat[11];		if (t1.isAffine()) {		    aff = true;		    mat[12] =  mat[13] = mat[14] = 0;		    mat[15] = 1;		} else {		    double tmp12 = t1.mat[12]*t2.mat[0] + t1.mat[13]*t2.mat[4] +			           t1.mat[14]*t2.mat[8];		    double tmp13 = t1.mat[12]*t2.mat[1] + t1.mat[13]*t2.mat[5] +		                   t1.mat[14]*t2.mat[9];		    double tmp14 = t1.mat[12]*t2.mat[2] + t1.mat[13]*t2.mat[6] +		                   t1.mat[14]*t2.mat[10];		    double tmp15 = t1.mat[12]*t2.mat[3] + t1.mat[13]*t2.mat[7] +			           t1.mat[14]*t2.mat[11] + t1.mat[15];		    mat[12] = tmp12;		    mat[13] = tmp13;		    mat[14] = tmp14;		    mat[15] = tmp15;		}	    } else {		tmp0 = t1.mat[0]*t2.mat[0] + t1.mat[1]*t2.mat[4] +		       t1.mat[2]*t2.mat[8] + t1.mat[3]*t2.mat[12];		tmp1 = t1.mat[0]*t2.mat[1] + t1.mat[1]*t2.mat[5] +		       t1.mat[2]*t2.mat[9] + t1.mat[3]*t2.mat[13];		tmp2 = t1.mat[0]*t2.mat[2] + t1.mat[1]*t2.mat[6] +		       t1.mat[2]*t2.mat[10] + t1.mat[3]*t2.mat[14];		tmp3 = t1.mat[0]*t2.mat[3] + t1.mat[1]*t2.mat[7] +		       t1.mat[2]*t2.mat[11] + t1.mat[3]*t2.mat[15];		tmp4 = t1.mat[4]*t2.mat[0] + t1.mat[5]*t2.mat[4] +		       t1.mat[6]*t2.mat[8] + t1.mat[7]*t2.mat[12];		tmp5 = t1.mat[4]*t2.mat[1] + t1.mat[5]*t2.mat[5] +		       t1.mat[6]*t2.mat[9] + t1.mat[7]*t2.mat[13];		tmp6 = t1.mat[4]*t2.mat[2] + t1.mat[5]*t2.mat[6] +		       t1.mat[6]*t2.mat[10] + t1.mat[7]*t2.mat[14];		tmp7 = t1.mat[4]*t2.mat[3] + t1.mat[5]*t2.mat[7] +		       t1.mat[6]*t2.mat[11] + t1.mat[7]*t2.mat[15];		tmp8 = t1.mat[8]*t2.mat[0] + t1.mat[9]*t2.mat[4] +		       t1.mat[10]*t2.mat[8] + t1.mat[11]*t2.mat[12];		tmp9 = t1.mat[8]*t2.mat[1] + t1.mat[9]*t2.mat[5] +		       t1.mat[10]*t2.mat[9] + t1.mat[11]*t2.mat[13];		tmp10 = t1.mat[8]*t2.mat[2] + t1.mat[9]*t2.mat[6] +		        t1.mat[10]*t2.mat[10] + t1.mat[11]*t2.mat[14];		tmp11 = t1.mat[8]*t2.mat[3] + t1.mat[9]*t2.mat[7] +		        t1.mat[10]*t2.mat[11] + t1.mat[11]*t2.mat[15];		if (t1.isAffine()) {		    mat[12] = t2.mat[12];		    mat[13] = t2.mat[13];		    mat[14] = t2.mat[14];		    mat[15] = t2.mat[15];		} else {		    double tmp12 = t1.mat[12]*t2.mat[0] + t1.mat[13]*t2.mat[4] +		                   t1.mat[14]*t2.mat[8] + t1.mat[15]*t2.mat[12];		    double tmp13 = t1.mat[12]*t2.mat[1] + t1.mat[13]*t2.mat[5] +		                   t1.mat[14]*t2.mat[9] + t1.mat[15]*t2.mat[13];		    double tmp14 = t1.mat[12]*t2.mat[2] + t1.mat[13]*t2.mat[6] +			           t1.mat[14]*t2.mat[10] + t1.mat[15]*t2.mat[14];		    double tmp15 = t1.mat[12]*t2.mat[3] + t1.mat[13]*t2.mat[7] +		                   t1.mat[14]*t2.mat[11] + t1.mat[15]*t2.mat[15];		    mat[12] = tmp12;		    mat[13] = tmp13;		    mat[14] = tmp14;		    mat[15] = tmp15;		}	    }	    mat[0] = tmp0;	    mat[1] = tmp1;	    mat[2] = tmp2;	    mat[3] = tmp3;	    mat[4] = tmp4;	    mat[5] = tmp5;	    mat[6] = tmp6;	    mat[7] = tmp7;	    mat[8] = tmp8;	    mat[9] = tmp9;	    mat[10] = tmp10;	    mat[11] = tmp11;	}	if (((t1.dirtyBits & CONGRUENT_BIT) == 0) &&	    ((t1.type & CONGRUENT) != 0) &&	    ((t2.dirtyBits & CONGRUENT_BIT) == 0) &&	    ((t2.type & CONGRUENT) != 0)) {	    type = t1.type & t2.type;	    dirtyBits = t1.dirtyBits | t2.dirtyBits | CLASSIFY_BIT |		        ROTSCALESVD_DIRTY | RIGID_BIT;	} else {	    if (aff) {		dirtyBits = ORTHO_BIT | CONGRUENT_BIT | RIGID_BIT |                            CLASSIFY_BIT | ROTSCALESVD_DIRTY;	    } else {		dirtyBits = CLASSIFY_ALL_DIRTY | ROTSCALESVD_DIRTY;	    }	}	if (autoNormalize) {	    normalize();	}    }