public idMat4 InverseFast() { idMat4 invMat = this; bool r = invMat.InverseFastSelf(); Debug.Assert(r); return(invMat); }
public idMat4 opAdd(ref idMat4 a) { idVec4[] a_mat = a.mat; mat[0].x += a_mat[0].x; mat[0].y += a_mat[0].y; mat[0].z += a_mat[0].z; mat[0].w += a_mat[0].w; mat[1].x += a_mat[1].x; mat[1].y += a_mat[1].y; mat[1].z += a_mat[1].z; mat[1].w += a_mat[1].w; mat[2].x += a_mat[2].x; mat[2].y += a_mat[2].y; mat[2].z += a_mat[2].z; mat[2].w += a_mat[2].w; mat[3].x += a_mat[3].x; mat[3].y += a_mat[3].y; mat[3].z += a_mat[3].z; mat[3].w += a_mat[3].w; return(this); }
public idMat4 opSub(ref idMat4 a) { idVec4[] a_mat = a.mat; mat[0].x -= a_mat[0].x; mat[0].y -= a_mat[0].y; mat[0].z -= a_mat[0].z; mat[0].w -= a_mat[0].w; mat[1].x -= a_mat[1].x; mat[1].y -= a_mat[1].y; mat[1].z -= a_mat[1].z; mat[1].w -= a_mat[1].w; mat[2].x -= a_mat[2].x; mat[2].y -= a_mat[2].y; mat[2].z -= a_mat[2].z; mat[2].w -= a_mat[2].w; mat[3].x -= a_mat[3].x; mat[3].y -= a_mat[3].y; mat[3].z -= a_mat[3].z; mat[3].w -= a_mat[3].w; return(this); }
public idMat4 Transpose() { idMat4 transpose = new idMat4(); for (int i = 0; i < 4; i++) { for (int j = 0; j < 4; j++) { transpose[i][j] = mat[j][i]; } } return(transpose); }
public bool Compare(ref idMat4 a, float epsilon) { float[] ptr1 = mat; float[] ptr2 = a.mat; for (int i = 0; i < 4 * 4; i++) { if (idMath.Fabs(ptr1[i] - ptr2[i]) > epsilon) { return(false); } } return(true); }
public bool Compare(ref idMat4 a) { float[] ptr1 = mat; float[] ptr2 = a.mat; for (int i = 0; i < 4 * 4; i++) { if (ptr1[i] != ptr2[i]) { return(false); } } return(true); }
public static idMat4 operator *(idMat4 a, idMat4 b) { // m1Ptr = reinterpret_cast<const float *>(this); // m2Ptr = reinterpret_cast<const float *>(&a); // dstPtr = reinterpret_cast<float *>(&dst); idMat4 dst = new idMat4(); for (int i = 0; i < 4; i++) { for (int j = 0; j < 4; j++) { // *dstPtr = m1Ptr[0] * m2Ptr[ 0 * 4 + j ] // + m1Ptr[1] * m2Ptr[ 1 * 4 + j ] // + m1Ptr[2] * m2Ptr[ 2 * 4 + j ] // + m1Ptr[3] * m2Ptr[ 3 * 4 + j ]; // dstPtr++; } // m1Ptr += 4; } return(dst); }
public idMat4 opMul(ref idMat4 a) { this = this * a; return(this); }
public bool Compare(ref idMat4 a, float epsilon) { float[] ptr1 = mat; float[] ptr2 = a.mat; for (int i = 0; i < 4 * 4; i++) if (idMath.Fabs(ptr1[i] - ptr2[i]) > epsilon) return false; return true; }
public idMat4 Transpose() { idMat4 transpose = new idMat4(); for (int i = 0; i < 4; i++) for (int j = 0; j < 4; j++) transpose[i][j] = mat[j][i]; return transpose; }
public bool Compare(ref idMat4 a) { float[] ptr1 = mat; float[] ptr2 = a.mat; for (int i = 0; i < 4 * 4; i++) if (ptr1[i] != ptr2[i]) return false; return true; }
public idMat4 opSub(ref idMat4 a) { idVec4[] a_mat = a.mat; mat[0].x -= a_mat[0].x; mat[0].y -= a_mat[0].y; mat[0].z -= a_mat[0].z; mat[0].w -= a_mat[0].w; mat[1].x -= a_mat[1].x; mat[1].y -= a_mat[1].y; mat[1].z -= a_mat[1].z; mat[1].w -= a_mat[1].w; mat[2].x -= a_mat[2].x; mat[2].y -= a_mat[2].y; mat[2].z -= a_mat[2].z; mat[2].w -= a_mat[2].w; mat[3].x -= a_mat[3].x; mat[3].y -= a_mat[3].y; mat[3].z -= a_mat[3].z; mat[3].w -= a_mat[3].w; return this; }
public idMat4 opAdd(ref idMat4 a) { idVec4[] a_mat = a.mat; mat[0].x += a_mat[0].x; mat[0].y += a_mat[0].y; mat[0].z += a_mat[0].z; mat[0].w += a_mat[0].w; mat[1].x += a_mat[1].x; mat[1].y += a_mat[1].y; mat[1].z += a_mat[1].z; mat[1].w += a_mat[1].w; mat[2].x += a_mat[2].x; mat[2].y += a_mat[2].y; mat[2].z += a_mat[2].z; mat[2].w += a_mat[2].w; mat[3].x += a_mat[3].x; mat[3].y += a_mat[3].y; mat[3].z += a_mat[3].z; mat[3].w += a_mat[3].w; return this; }
public idMat4 opMul(ref idMat4 a) { this = this * a; return this; }
public static idMat4 operator *(idMat4 a, idMat4 b) { // m1Ptr = reinterpret_cast<const float *>(this); // m2Ptr = reinterpret_cast<const float *>(&a); // dstPtr = reinterpret_cast<float *>(&dst); idMat4 dst = new idMat4(); for (int i = 0; i < 4; i++) { for (int j = 0; j < 4; j++) { // *dstPtr = m1Ptr[0] * m2Ptr[ 0 * 4 + j ] // + m1Ptr[1] * m2Ptr[ 1 * 4 + j ] // + m1Ptr[2] * m2Ptr[ 2 * 4 + j ] // + m1Ptr[3] * m2Ptr[ 3 * 4 + j ]; // dstPtr++; } // m1Ptr += 4; } return dst; }