/// <summary> /// TODO: document this method... /// /// Not 100% sure what this does -- it came from the GLTK code. /// I think it keeps the rotations the same but makes them more 'normalised'? /// </summary> public Matrix Orthogonalise() { Vector lColumn1 = new Vector(this[1, 0], this[1, 1], this[1, 2]); Vector lColumn2 = new Vector(this[2, 0], this[2, 1], this[2, 2]); Vector lNewColumn0 = (lColumn1 ^ lColumn2).Normalise(); Vector lNewColumn1 = lColumn1.Normalise(); Vector lNewColumn2 = (lNewColumn0 ^ lColumn1).Normalise(); return(new Matrix( lNewColumn0.x, lNewColumn0.y, lNewColumn0.z, 0, lNewColumn1.x, lNewColumn1.y, lNewColumn1.z, 0, lNewColumn2.x, lNewColumn2.y, lNewColumn2.z, 0, this[3, 0], this[3, 1], this[3, 2], this[3, 3])); }
public void LookAt(Point xiTarget, Vector xiUp) { Vector lV1 = (Position - xiTarget).Normalise(); Vector lV2 = xiUp.Normalise(); Vector lV3 = lV2 ^ lV1; lV2 = lV1 ^ lV3; mTransform = new Matrix( lV3.x, lV3.y, lV3.z, 0, lV2.x, lV2.y, lV2.z, 0, lV1.x, lV1.y, lV1.z, 0, mTransform[3, 0], mTransform[3, 1], mTransform[3, 2], mTransform[3, 3]); Reorthogonalise(); }
/// <summary> /// TODO: document this method... /// /// Not 100% sure what this does -- it came from the GLTK code. /// I think it keeps the rotations the same but makes them more 'normalised'? /// </summary> public Matrix Orthogonalise() { Vector lColumn1 = new Vector(this[1, 0], this[1, 1], this[1, 2]); Vector lColumn2 = new Vector(this[2, 0], this[2, 1], this[2, 2]); Vector lNewColumn0 = (lColumn1 ^ lColumn2).Normalise(); Vector lNewColumn1 = lColumn1.Normalise(); Vector lNewColumn2 = (lNewColumn0 ^ lColumn1).Normalise(); return new Matrix( lNewColumn0.x, lNewColumn0.y, lNewColumn0.z, 0, lNewColumn1.x, lNewColumn1.y, lNewColumn1.z, 0, lNewColumn2.x, lNewColumn2.y, lNewColumn2.z, 0, this[3, 0], this[3, 1], this[3, 2], this[3, 3]); }
public void LookAt(Point xiTarget, Vector xiUp) { Vector lV1 = (Position - xiTarget).Normalise(); Vector lV2 = xiUp.Normalise(); Vector lV3 = lV2 ^ lV1; lV2 = lV1 ^ lV3; mTransform = new Matrix( lV3.x, lV3.y, lV3.z, 0, lV2.x, lV2.y, lV2.z, 0, lV1.x, lV1.y, lV1.z, 0, mTransform[3, 0], mTransform[3, 1], mTransform[3, 2], mTransform[3, 3]); Reorthogonalise(); }