Ejemplo n.º 1
0
 /// <summary>
 /// Creates a transformation matrix that uses three basis vectors to construct the matrix that transform points expressed in the three basis vectors to points in
 /// the coordinate system.
 /// </summary>
 /// <param name="xBasis">Basis vector for the x-direction.</param>
 /// <param name="yBasis">Basis vector for the y-direction.</param>
 /// <returns>A transformation matrix that uses the three basis vectors, and a location</returns>
 public static Matrix2x2 NewFromBasisVectors(VectorD2D xBasis, VectorD2D yBasis)
 {
     return(new Matrix2x2(
                xBasis.X, xBasis.Y,
                yBasis.X, yBasis.Y
                ));
 }
Ejemplo n.º 2
0
        /// <summary>
        /// Transforms the specified vector <paramref name="v"/>.
        /// The transformation is carried out as a prepend transformation, i.e. result = v * matrix (v considered as horizontal vector).
        /// </summary>
        /// <param name="v">The vector to transform.</param>
        /// <returns>The transformed vector.</returns>
        public VectorD2D Transform(VectorD2D v)
        {
            double x = v.X;
            double y = v.Y;

            return(new VectorD2D(
                       x * M11 + y * M21,
                       x * M12 + y * M22
                       ));
        }