public static SourceCTransform MatrixTransform(SourceMatrix3x4 _in) { SourceCTransform _out = new SourceCTransform(); MatrixTransform(_in, ref _out); return(_out); }
public static SourceMatrix3x4 TransformMatrix(SourceCTransform _in) { SourceMatrix3x4 _out = new SourceMatrix3x4(); TransformMatrix(_in, ref _out); return(_out); }
public static void VectorIRotate(SourceVector v, SourceCTransform t, ref SourceVector _out) { // FIXME: Make work directly with the transform SourceMatrix3x4 m = new SourceMatrix3x4(); TransformMatrix(t, ref m); VectorIRotate(v, m, ref _out); }
public static SourceVector TransformPoint(SourceCTransform tm, SourceVector p) { return(new SourceVector( tm.m_vPosition.x + (1.0f - 2.0f * tm.m_orientation.y * tm.m_orientation.y - 2.0f * tm.m_orientation.z * tm.m_orientation.z) * p.x + (2.0f * tm.m_orientation.x * tm.m_orientation.y - 2.0f * tm.m_orientation.w * tm.m_orientation.z) * p.y + (2.0f * tm.m_orientation.x * tm.m_orientation.z + 2.0f * tm.m_orientation.w * tm.m_orientation.y) * p.z, tm.m_vPosition.y + (2.0f * tm.m_orientation.x * tm.m_orientation.y + 2.0f * tm.m_orientation.w * tm.m_orientation.z) * p.x + (1.0f - 2.0f * tm.m_orientation.x * tm.m_orientation.x - 2.0f * tm.m_orientation.z * tm.m_orientation.z) * p.y + (2.0f * tm.m_orientation.y * tm.m_orientation.z - 2.0f * tm.m_orientation.w * tm.m_orientation.x) * p.z, tm.m_vPosition.z + (2.0f * tm.m_orientation.x * tm.m_orientation.z - 2.0f * tm.m_orientation.w * tm.m_orientation.y) * p.x + (2.0f * tm.m_orientation.y * tm.m_orientation.z + 2.0f * tm.m_orientation.w * tm.m_orientation.x) * p.y + (1.0f - 2.0f * tm.m_orientation.x * tm.m_orientation.x - 2.0f * tm.m_orientation.y * tm.m_orientation.y) * p.z )); }
//inline void TransformPlane( const cplane_t &inPlane, cplane_t &outPlane ) const; //inline void InverseTransformPlane( const cplane_t &inPlane, cplane_t &outPlane ) const; /// Computes an inverse. Uses the 'TR' naming to be consistent with the same method in matrix3x4_t (which only works with orthonormal matrices) public void InverseTR(ref SourceCTransform _out) { SourceMatrix3x4 xForm = ToMatrix(); _out = xForm.InverseTR().ToCTransform(); }
public static void MatrixTransform(SourceMatrix3x4 _in, ref SourceCTransform _out) { MatrixQuaternion(_in, ref _out.m_orientation); MatrixGetColumn(_in, 3, ref _out.m_vPosition); }
public static void RotatePoint(SourceCTransform tm, SourceVector p, ref SourceVector _out) { _out.x = (1.0f - 2.0f * tm.m_orientation.y * tm.m_orientation.y - 2.0f * tm.m_orientation.z * tm.m_orientation.z) * p.x + (2.0f * tm.m_orientation.x * tm.m_orientation.y - 2.0f * tm.m_orientation.w * tm.m_orientation.z) * p.y + (2.0f * tm.m_orientation.x * tm.m_orientation.z + 2.0f * tm.m_orientation.w * tm.m_orientation.y) * p.z; _out.y = (2.0f * tm.m_orientation.x * tm.m_orientation.y + 2.0f * tm.m_orientation.w * tm.m_orientation.z) * p.x + (1.0f - 2.0f * tm.m_orientation.x * tm.m_orientation.x - 2.0f * tm.m_orientation.z * tm.m_orientation.z) * p.y + (2.0f * tm.m_orientation.y * tm.m_orientation.z - 2.0f * tm.m_orientation.w * tm.m_orientation.x) * p.z; _out.z = (2.0f * tm.m_orientation.x * tm.m_orientation.z - 2.0f * tm.m_orientation.w * tm.m_orientation.y) * p.x + (2.0f * tm.m_orientation.y * tm.m_orientation.z + 2.0f * tm.m_orientation.w * tm.m_orientation.x) * p.y + (1.0f - 2.0f * tm.m_orientation.x * tm.m_orientation.x - 2.0f * tm.m_orientation.y * tm.m_orientation.y) * p.z; }
public static void TransformVectorsForward(SourceCTransform _in, ref SourceVector pForward) { QuaternionVectorsForward(_in.m_orientation, ref pForward); }
public static void TransformVectorsFLU(SourceCTransform _in, ref SourceVector pForward, ref SourceVector pLeft, ref SourceVector pUp) { QuaternionVectorsFLU(_in.m_orientation, ref pForward, ref pLeft, ref pUp); }
public static void TransformMatrix(SourceCTransform _in, ref SourceMatrix3x4 _out) { QuaternionMatrix(_in.m_orientation, _in.m_vPosition, ref _out); }