Example #1
0
 public static void Validate(this Matrix2f m)
 {
     if (IsInvalid(m.M11) || IsInvalid(m.M12) ||
         IsInvalid(m.M21) || IsInvalid(m.M22))
     {
         throw new NotFiniteNumberException("Invalid value.");
     }
 }
Example #2
0
        /// <summary>
        /// Transforms the vector by the matrix.
        /// </summary>
        /// <param name="v">Vector2 to transform.</param>
        /// <param name="matrix">Matrix to use as the transformation.</param>
        /// <param name="result">Product of the transformation.</param>
        public static void Transform(ref Vector2f v, ref Matrix2f matrix, out Vector2f result)
        {
            float vX = v.X;
            float vY = v.Y;

#if !WINDOWS
            result = new Vector2f();
#endif
            result.X = vX * matrix.M11 + vY * matrix.M21;
            result.Y = vX * matrix.M12 + vY * matrix.M22;
        }