public void AddMatrix2(Matrix2 other) { elements[0, 0] += other.elements[0, 0]; elements[0, 1] += other.elements[0, 1]; elements[1, 0] += other.elements[1, 0]; elements[0, 1] += other.elements[1, 1]; }
public void ApplyMatrix(Matrix2 m, bool saveMatrix) { p[0].MulMatrix2(m); p[1].MulMatrix2(m); p[2].MulMatrix2(m); p[3].MulMatrix2(m); if (saveMatrix) matrix = m; }
public void MulMatrix2(Matrix2 other) { Matrix2 temp = new Matrix2(); temp.elements[0, 0] = (elements[0, 0] * other.elements[0, 0]) + (elements[1, 0] * other.elements[0, 1]); temp.elements[1, 0] = (elements[0, 0] * other.elements[0, 1]) + (elements[1, 0] * other.elements[1, 1]); temp.elements[0, 1] = (elements[0, 1] * other.elements[0, 0]) + (elements[1, 1] * other.elements[0, 1]); temp.elements[1, 1] = (elements[0, 1] * other.elements[1, 0]) + (elements[1, 1] * other.elements[1, 1]); elements = temp.elements; }
public bool IsEqual(Matrix2 other) { if (elements[0, 0] != other.elements[0, 0]) return false; if (elements[0, 1] != other.elements[0, 1]) return false; if (elements[1, 0] != other.elements[1, 0]) return false; if (elements[1, 1] != other.elements[1, 1]) return false; return true; }
public bool IsEqual(Matrix2 other) { if (elements[0, 0] != other.elements[0, 0]) { return(false); } if (elements[0, 1] != other.elements[0, 1]) { return(false); } if (elements[1, 0] != other.elements[1, 0]) { return(false); } if (elements[1, 1] != other.elements[1, 1]) { return(false); } return(true); }
public void SubtractMatrix2(Matrix2 other) { elements[0, 0] -= other.elements[0, 0]; elements[0, 1] -= other.elements[0, 1]; elements[1, 0] -= other.elements[1, 0]; elements[0, 1] -= other.elements[1, 1]; }
public void MulMatrix2(Matrix2 m) { float xx = x; float yy = y; x = (m.elements[0, 0] * xx) + (m.elements[0, 1] * yy); y = (m.elements[1, 0] * xx) + (m.elements[1, 1] * yy); }