Beispiel #1
0
        private static void Plot2UserCoordinateSystem()
        {
            Console.WriteLine();
            Console.WriteLine("**********Plot2UserCoordinateSystem**************");
            Recatangle    rect = new Recatangle(new Point(73.79926, -87.735), 303.39074, 160.05);
            List <Matrix> ctms = new List <Matrix>();

            double[][] p1 = new double[][] {
                new double[] { 4 / 3.0000, 0, 0 },
                new double[] { 0, 4 / 3.0000, 0 },
                new double[] { 0, 0, 1 }
            };
            double[][] p2 = new double[][] {
                new double[] { 1, 0, 0 },
                new double[] { 0, 1, 0 },
                new double[] { 0, 0, 1 }
            };
            double[][] p3 = new double[][] {
                new double[] { 1, 0, 0 },
                new double[] { 0, 1, 0 },
                new double[] { 0, 792, 1 }
            };



            Matrix m1 = new Matrix(p1);
            Matrix m2 = new Matrix(p2);
            Matrix m3 = new Matrix(p3);

            ctms.Add(m1);
            ctms.Add(m2);
            ctms.Add(m3);

            //Console.WriteLine(PDF2User.setCTMTransform(rect_10, ctms));


            Console.WriteLine("#########################");
            Recatangle imageRect = PDF2User.setCTMTransform(rect, ctms);


            Console.ReadKey();
        }
Beispiel #2
0
        private static void Image2PatternCoordinateSystem()
        {
            Console.WriteLine("==========================");
            Recatangle    rect_10 = new Recatangle(new Point(0, 1), 1, 1);
            List <Matrix> ctms    = new List <Matrix>();

            double[][] p1 = new double[][] {
                new double[] { 404.5714, 0, 0 },
                new double[] { 0, 213.4286, 0 },
                new double[] { 0, -213.4286, 1 }
            };
            double[][] p2 = new double[][] {
                new double[] { 0.00185381, 0, 0 },
                new double[] { 0, 0.00351407, 0 },
                new double[] { 0, 0, 1 }
            };
            double[][] p3 = new double[][] {
                new double[] { 1, 0, 0 },
                new double[] { 0, 1, 0 },
                new double[] { 0, -257.785, 1 }
            };

            double[][] p4 = new double[][] {
                new double[] { 1, 0, 0 },
                new double[] { 0, 1, 0 },
                new double[] { 0, 257.785, 1 }
            };

            Matrix m1 = new Matrix(p1);
            Matrix m2 = new Matrix(p2);
            Matrix m3 = new Matrix(p3);
            Matrix m4 = new Matrix(p4);

            ctms.Add(m1);
            ctms.Add(m2);
            ctms.Add(m3);
            ctms.Add(m4);
            //Console.WriteLine(PDF2User.setCTMTransform(rect_10, ctms));


            Console.WriteLine("###########Image2PatternCoordinateSystem##############");
            Recatangle imageRect = PDF2User.setCTMTransform(rect_10, ctms);

            Console.WriteLine("###########ImageRect finished!!!##############");
            Recatangle    BBOX  = new Recatangle(new Point(-5, 5), 387.19, 257.785);
            List <Matrix> ctms1 = new List <Matrix>();

            ctms1.Add(new Matrix(new double[][] {
                new double[] { 4 / 3.0000, 0, 0 },
                new double[] { 0, 4 / 3.0000, 0 },
                new double[] { 0, 792, 1 }
            }));
            BBOX = PDF2User.setCTMTransform(BBOX, ctms);
            Console.WriteLine("###########BBOX finished!!!##############");


            Console.WriteLine("imageRect");
            Matrix.PrintMatrix(Matrix.ConvertRect2Arr(imageRect));


            Console.WriteLine("BBOX");
            Matrix.PrintMatrix(Matrix.ConvertRect2Arr(BBOX));



            Console.WriteLine("相交面积");
            Console.WriteLine(Rectangles.getSequare(imageRect, BBOX));
            Console.WriteLine();
            //Console.ReadKey();
        }