Exemple #1
0
        private static MatrixF CreateIdentity()
        {
            MatrixF matrix = new MatrixF();

            matrix.SetMatrix(1, 0,
                             0, 1,
                             0, 0,
                             MatrixTypes.TRANSFORM_IS_IDENTITY);
            return(matrix);
        }
Exemple #2
0
        internal static MatrixF CreateScaling(Float scaleX, Float scaleY)
        {
            MatrixF matrix = new MatrixF();

            matrix.SetMatrix(scaleX, 0,
                             0, scaleY,
                             0, 0,
                             MatrixTypes.TRANSFORM_IS_SCALING);
            return(matrix);
        }
Exemple #3
0
        internal static MatrixF CreateTranslation(Float offsetX, Float offsetY)
        {
            MatrixF matrix = new MatrixF();

            matrix.SetMatrix(1, 0,
                             0, 1,
                             offsetX, offsetY,
                             MatrixTypes.TRANSFORM_IS_TRANSLATION);

            return(matrix);
        }
Exemple #4
0
        internal static MatrixF CreateSkewRadians(Float skewX, Float skewY)
        {
            MatrixF matrix = new MatrixF();

            matrix.SetMatrix(1.0F, (Float)Math.Tan(skewY),
                             (Float)Math.Tan(skewX), 1.0F,
                             0.0F, 0.0F,
                             MatrixTypes.TRANSFORM_IS_UNKNOWN);

            return(matrix);
        }
Exemple #5
0
        internal static MatrixF CreateScaling(Float scaleX, Float scaleY, Float centerX, Float centerY)
        {
            MatrixF matrix = new MatrixF();

            matrix.SetMatrix(scaleX, 0,
                             0, scaleY,
                             centerX - scaleX * centerX, centerY - scaleY * centerY,
                             MatrixTypes.TRANSFORM_IS_SCALING | MatrixTypes.TRANSFORM_IS_TRANSLATION);

            return(matrix);
        }
Exemple #6
0
        internal static MatrixF CreateRotationRadians(Float angle, Float centerX, Float centerY)
        {
            MatrixF matrix = new MatrixF();

            Float sin = (Float)Math.Sin(angle);
            Float cos = (Float)Math.Cos(angle);
            Float dx  = (centerX * (1.0F - cos)) + (centerY * sin);
            Float dy  = (centerY * (1.0F - cos)) - (centerX * sin);

            matrix.SetMatrix(cos, sin,
                             -sin, cos,
                             dx, dy,
                             MatrixTypes.TRANSFORM_IS_UNKNOWN);

            return(matrix);
        }