Example #1
0
        public static AffineTransform2 operator *(AffineTransform2 T1, AffineTransform2 T2)
        {
            AffineTransform2 S = new AffineTransform2();

            S.mat = MatrixProduct(T1.mat, T2.mat);
            return(S);
        }
Example #2
0
        public static AffineTransform2 PointAndVectorsToPointAndVectors(
            Point p1, Vector v1, Vector v2,
            Point q1, Vector w1, Vector w2)
        {
            AffineTransform2 Trans1 = AffineTransform2.Translate(p1, new Point(0, 0));
            LinearTransform2 T      = LinearTransform2.VectorsToVectors(v1, v2, w1, w2);
            AffineTransform2 Trans2 = AffineTransform2.Translate(new Point(0, 0), q1);
            AffineTransform2 S      = new AffineTransform2();

            S.mat = T.Matrix();

            return(Trans2 * S * Trans1);

            /*
             * double[,] linmat = T.Matrix();
             * for (int i = 0; i < 2; i++)
             * {
             *  for (int j = 0; j < 2; j++)
             *  {
             *      W.mat[i, j] = linmat[i, j];
             *  }
             * }
             * return W;
             */
        }
Example #3
0
        public static AffineTransform2 Translate(Vector v)
        {
            AffineTransform2 T = new AffineTransform2();

            T.mat[0, 2] = v.X;
            T.mat[1, 2] = v.Y;
            return(T);
        }
Example #4
0
        public AffineTransform2 InverseTransform()
        {
            double[,] m = MatrixInverse(mat);
            AffineTransform2 T = new AffineTransform2();

            T.mat = m;
            return(T);
        }
Example #5
0
        public static AffineTransform2 RotateAboutPoint(Point p, double angle)
        {
            Point            origin = new Point();
            AffineTransform2 T1     = Translate(origin - p);
            AffineTransform2 T2     = RotateXY(angle);
            AffineTransform2 T3     = Translate(p - origin);

            return(T3 * T2 * T1);
        }
Example #6
0
        public static AffineTransform2 AxisScale(double xamount, double yamount)
        {
            AffineTransform2 T = new AffineTransform2();

            T.mat[0, 0] = xamount;
            T.mat[1, 1] = yamount;
            T.mat[2, 2] = 1.0d;
            return(T);
        }
Example #7
0
        public static AffineTransform2 PointsAndVectorToPointsAndVector(
            Point p1, Point p2, Vector v1,
            Point q1, Point q2, Vector w1)
        {
            Vector v2 = p2 - p1;
            Vector w2 = q2 - q1;

            return(AffineTransform2.PointAndVectorsToPointAndVectors(p1, v1, v2, q1, w1, w2));
        }
        public static ProjectiveTransform2 AxisScale(double xamount, double yamount)
        {
            AffineTransform2     T  = AffineTransform2.AxisScale(xamount, yamount);
            ProjectiveTransform2 T2 = new ProjectiveTransform2();

            T2.mat = T.mat;
            T.mat  = null;
            return(T2);
        }
        public static ProjectiveTransform2 Translate(Point p, Point q)
        {
            AffineTransform2     T  = AffineTransform2.Translate(p, q);
            ProjectiveTransform2 T2 = new ProjectiveTransform2();

            T2.mat = T.mat;
            T.mat  = null;
            return(T2);
        }
        public static ProjectiveTransform2 Translate(Vector v)
        {
            AffineTransform2     T  = AffineTransform2.Translate(v);
            ProjectiveTransform2 T2 = new ProjectiveTransform2();

            T2.mat = T.mat;
            T.mat  = null;
            return(T2);
        }
        public static ProjectiveTransform2 RotateXY(double angle)
        {
            AffineTransform2     T  = AffineTransform2.RotateXY(angle);
            ProjectiveTransform2 T2 = new ProjectiveTransform2();

            T2.mat = T.mat;
            T.mat  = null;
            return(T2);
        }
Example #12
0
        public static AffineTransform2 RotateXY(double angle)
        {
            AffineTransform2 T = new AffineTransform2();

            T.mat[0, 0] = Math.Cos(angle);
            T.mat[1, 1] = T.mat[0, 0];
            T.mat[1, 0] = Math.Sin(angle);
            T.mat[0, 1] = -T.mat[1, 0];
            return(T);
        }
Example #13
0
        public static AffineTransform2 PointsToPoints(
            Point p1, Point p2, Point p3,
            Point q1, Point q2, Point q3)
        {
            Vector v1 = p2 - p1;
            Vector v2 = p3 - p1;
            Vector w1 = q2 - q1;
            Vector w2 = q3 - q1;

            return(AffineTransform2.PointAndVectorsToPointAndVectors(p1, v1, v2, q1, w1, w2));
        }