/// <summary>Transform a Normal by the given Matrix</summary> /// <remarks> /// This calculates the inverse of the given matrix, use TransformNormalInverse if you /// already have the inverse to avoid this extra calculation /// </remarks> /// <param name="norm">The normal to transform</param> /// <param name="mat">The desired transformation</param> /// <returns>The transformed normal</returns> public static Vector3 TransformNormal(Vector3 norm, Matrix4 mat) { mat.Invert(); return(TransformNormalInverse(norm, mat)); }
/// <summary>Transform a Normal by the given Matrix</summary> /// <remarks> /// This calculates the inverse of the given matrix, use TransformNormalInverse if you /// already have the inverse to avoid this extra calculation /// </remarks> /// <param name="norm">The normal to transform</param> /// <param name="mat">The desired transformation</param> /// <param name="result">The transformed normal</param> public static void TransformNormal(ref Vector3 norm, ref Matrix4 mat, out Vector3 result) { Matrix4 Inverse = Matrix4.Invert(mat); Vector3.TransformNormalInverse(ref norm, ref Inverse, out result); }
/// <summary> /// Transform a Normal by the given Matrix /// </summary> /// <remarks> /// This calculates the inverse of the given matrix, use TransformNormalInverse if you /// already have the inverse to avoid this extra calculation /// </remarks> /// <param name="norm">The normal to transform</param> /// <param name="mat">The desired transformation</param> /// <returns>The transformed normal</returns> public static Vector3 TransformNormal(Vector3 norm, Matrix4 mat) { mat.Invert(); return TransformNormalInverse(norm, mat); }