public static void Transform(ref FPVector4 vector, ref FPMatrix4x4 matrix, out FPVector4 result) { result.x = vector.x * matrix.M11 + vector.y * matrix.M12 + vector.z * matrix.M13 + vector.w * matrix.M14; result.y = vector.x * matrix.M21 + vector.y * matrix.M22 + vector.z * matrix.M23 + vector.w * matrix.M24; result.z = vector.x * matrix.M31 + vector.y * matrix.M32 + vector.z * matrix.M33 + vector.w * matrix.M34; result.w = vector.x * matrix.M41 + vector.y * matrix.M42 + vector.z * matrix.M43 + vector.w * matrix.M44; }
/** * @brief Transform a direction from world space to local space. **/ public FPVector4 InverseTransformDirection(FPVector4 direction) { Debug.Assert(direction.w == FP.Zero); FPMatrix4x4 matrix = FPMatrix4x4.Translate(position) * FPMatrix4x4.Rotate(rotation); return(FPVector4.Transform(direction, FPMatrix4x4.Inverse(matrix))); }
public static FPVector4 Transform(FPVector position, FPMatrix4x4 matrix) { FPVector4 result; FPVector4.Transform(ref position, ref matrix, out result); return(result); }