///<summary>
/// Transforms a vector by an affine transform's inverse.
///</summary>
///<param name="position">Position to transform.</param>
///<param name="transform">Transform to invert and apply.</param>
///<param name="transformed">Transformed position.</param>
public static void TransformInverse(ref Vector3 position, ref AffineTransform transform, out Vector3 transformed)
{
Vector3.Subtract(ref position, ref transform.Translation, out transformed);
Matrix3x3 inverse;
Matrix3x3.Invert(ref transform.LinearTransform, out inverse);
Matrix3x3.TransformTranspose(ref transformed, ref inverse, out transformed);
}