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

            matrix.SetMatrix(1, 0,
                             0, 1,
                             0, 0,
                             MatrixTypes.TRANSFORM_IS_IDENTITY);
            return(matrix);
        }
示例#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);
        }
示例#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);
        }
示例#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);
        }
示例#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);
        }
示例#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);
        }