Exemplo n.º 1
0
        static void TestShapesMatrixRot()
        {
            List <Vector3D> points       = new List <Vector3D>();
            List <Vector3D> pointResults = new List <Vector3D>();
            Shapes          geoShapes    = new Shapes();

            string currpath = Directory.GetCurrentDirectory();

            Directory.CreateDirectory(currpath + @"\MatrixRotation");
            string path = currpath + @"\MatrixRotation\";


            Vector3D center1b = new Vector3D();

            center1b.X = 0.0; center1b.Y = 0.0; center1b.Z = 0.0;
            List <Vector3D> pointbuf = new List <Vector3D>();

            pointbuf.Add(new Vector3D(0.0, 0.0, 0.0));
            pointbuf.Add(new Vector3D(2.0, 1.0, 0.5));
            points = geoShapes.CreateLine(center1b, pointbuf, 54.7356, 0.00, 45.00);
            geoShapes.OutputPoints(FeatureType.enLine, "Ellipse-geo", points, path + @"testcaseEllipse-geo.txt");
            pointbuf.Clear();

            Vector3D center1a = new Vector3D();

            center1a.X = 2.0; center1a.Y = 1.0; center1a.Z = 0.0;
            double aRadius1 = 1.0;
            double bRadius1 = 0.5;

            points = geoShapes.CreateEllipse(center1a, aRadius1, bRadius1, 60.0, 0.0, 0.0, 0.0);
            geoShapes.OutputPoints(FeatureType.enEllipse, "Ellipse-geo", points, path + @"testcaseEllipse-geo.txt");
            points.Clear();


            Vector3D center = new Vector3D();

            center.X = 1.0; center.Y = 2.0; center.Z = 3.0;
            double aRadius = 2.0;
            double bRadius = 4.0;

            points = geoShapes.CreateEllipse(center, aRadius, bRadius, 60.0, 30.0, 0.0, 0.0);
            geoShapes.OutputPoints(FeatureType.enEllipse, "Ellipse-2-x30y0z0", points, path + @"testcaseEllipse-2-x30y0z0.txt");
            points.Clear();

            points = geoShapes.CreateEllipse(center, aRadius, bRadius, 60.0, 0.0, 30.0, 0.0);
            geoShapes.OutputPoints(FeatureType.enEllipse, "Ellipse-2-x0y30z0", points, path + @"testcaseEllipse-2-x0y30z0.txt");
            points.Clear();

            points = geoShapes.CreateEllipse(center, aRadius, bRadius, 60.0, 30.0, 30.0, 0.0);
            geoShapes.OutputPoints(FeatureType.enEllipse, "Ellipse-2-x30y30z0", points, path + @"testcaseEllipse-2-x30y30z0.txt");
            points.Clear();

            points = geoShapes.CreateEllipse(center, aRadius, bRadius, 60.0, 30.0, 30.0, 30.0);
            geoShapes.OutputPoints(FeatureType.enEllipse, "Ellipse-2-x30y30z30", points, path + @"testcaseEllipse-1-x30y30z30.txt");
            points.Clear();

            points = geoShapes.CreateEllipse(center, bRadius, aRadius, 60.0, 0.0, 0.0, 0.0);
            geoShapes.OutputPoints(FeatureType.enEllipse, "Ellipse-1_MajorX-XY", points, path + @"testcaseEllipse-1_MajorX-XY.txt");
            points.Clear();

            points = geoShapes.CreateEllipse(center, aRadius, bRadius, 60.0, 0.0, 0.0, 0.0);
            geoShapes.OutputPoints(FeatureType.enEllipse, "Ellipse-1_MajorY-XY", points, path + @"testcaseEllipse-1_MajorY-XY.txt");
            points.Clear();

            // Rotation around Z
            points = geoShapes.CreateEllipse(center, aRadius, bRadius, 60.0, 0.0, 0.0, 30.0);
            geoShapes.OutputPoints(FeatureType.enEllipse, "Ellipse-1_30Z", points, path + @"testcaseEllipse-1_30Z.txt");
            points.Clear();

            points = geoShapes.CreateEllipse(center, aRadius, bRadius, 60.0, 0.0, 0.0, -30.0);
            geoShapes.OutputPoints(FeatureType.enEllipse, "Ellipse-1_Minus30Z", points, path + @"testcaseEllipse-1_Minus30Z.txt");
            points.Clear();

            center.X = 0.0; center.Y = 0.0; center.Z = 0.0;
            points   = geoShapes.CreateEllipse(center, aRadius, bRadius, 60.0, 0.0, 0.0, 30.0);
            geoShapes.OutputPoints(FeatureType.enEllipse, "Ellipse-2-Angle30Z", points, path + @"testcaseEllipse-2-Angle30Z.txt");
            points.Clear();

            points = geoShapes.CreateEllipse(center, aRadius, bRadius, 60.0, 0.0, 0.0, 150.0);
            geoShapes.OutputPoints(FeatureType.enEllipse, "Ellipse-2-Angle150Z", points, path + @"testcaseEllipse-2-Angle150Z.txt");
            points.Clear();

            points = geoShapes.CreateEllipse(center, aRadius, bRadius, 60.0, 0.0, 0.0, 210.0);
            geoShapes.OutputPoints(FeatureType.enEllipse, "Ellipse-2-Angle210Z", points, path + @"testcaseEllipse-2-Angle210Z.txt");
            points.Clear();

            points = geoShapes.CreateEllipse(center, aRadius, bRadius, 60.0, 0.0, 0.0, 330.0);
            geoShapes.OutputPoints(FeatureType.enEllipse, "Ellipse-2-Angle330Z", points, path + @"testcaseEllipse-2-Angle330Z.txt");
            points.Clear();


            // Rotation around Y
            points = geoShapes.CreateEllipse(center, bRadius, aRadius, 60.0, 0.0, -90.0, 0.0);
            geoShapes.OutputPoints(FeatureType.enEllipse, "Ellipse-1_MajorZ-YZ", points, path + @"testcaseEllipse-1_MajorZ-YZ.txt");
            points.Clear();

            points = geoShapes.CreateEllipse(center, aRadius, bRadius, 60.0, 0.0, -90.0, 0.0);
            geoShapes.OutputPoints(FeatureType.enEllipse, "Ellipse-1_MajorY-YZ", points, path + @"testcaseEllipse-1_MajorY-YZ.txt");
            points.Clear();


            // Rotation around X
            points = geoShapes.CreateEllipse(center, aRadius, bRadius, 60.0, 30.0, -90.0, 0.0);
            geoShapes.OutputPoints(FeatureType.enEllipse, "Ellipse-1_30X-YZ", points, path + @"testcaseEllipse-1_30X-YZ.txt");
            points.Clear();

            points = geoShapes.CreateEllipse(center, aRadius, bRadius, 60.0, -30.0, -90.0, 00.0);
            geoShapes.OutputPoints(FeatureType.enEllipse, "Ellipse-1_Minus30X-YZ", points, path + @"testcaseEllipse-1_Minus30X-YZ.txt");
            points.Clear();



            double radius = 4.0;
            double height = 2.0;

            points = geoShapes.CreateCylinder(center, radius, height, 120.0, 0.0, 0.0, 00.0);
            geoShapes.OutputPoints(FeatureType.enCylinder, "Cylinder-1", points, path + @"testcaseCylinder-1.txt");
            points.Clear();

            points = geoShapes.CreateCylinder(center, radius, height, 120.0, 30.0, 0.0, 00.0);
            geoShapes.OutputPoints(FeatureType.enCylinder, "Cylinder-2", points, path + @"testcaseCylinder-2.txt");
            points.Clear();
            points = geoShapes.CreateCylinder(center, radius, height, 120.0, -30.0, 0.0, 00.0);
            geoShapes.OutputPoints(FeatureType.enCylinder, "Cylinder-2-1", points, path + @"testcaseCylinder-2-1.txt");
            points.Clear();

            points = geoShapes.CreateCylinder(center, radius, height, 120.0, 0.0, 30.0, 00.0);
            geoShapes.OutputPoints(FeatureType.enCylinder, "Cylinder-3", points, path + @"testcaseCylinder-3.txt");
            points.Clear();

            points = geoShapes.CreateCylinder(center, radius, height, 120.0, 0.0, -30.0, 00.0);
            geoShapes.OutputPoints(FeatureType.enCylinder, "Cylinder-3-1", points, path + @"testcaseCylinder-3-1.txt");
            points.Clear();

            points = geoShapes.CreateCylinder(center, radius, height, 120.0, 54.7356, 0.0, 45.0);
            geoShapes.OutputPoints(FeatureType.enCylinder, "Cylinder-4", points, path + @"testcaseCylinder-4.txt");
            points.Clear();

            points = geoShapes.CreateCylinder(center, radius, height, 120.0, 54.7356, 0.0, 135.0);
            geoShapes.OutputPoints(FeatureType.enCylinder, "Cylinder-4-1", points, path + @"testcaseCylinder-4-1.txt");
            points.Clear();

            points = geoShapes.CreateCylinder(center, radius, height, 120.0, 180.0 - 54.7356, 0.0, 225.0);
            geoShapes.OutputPoints(FeatureType.enCylinder, "Cylinder-4-2", points, path + @"testcaseCylinder-4-2.txt");
            points.Clear();

            points = geoShapes.CreateCylinder(center, radius, height, 120.0, 180.0 - 54.7356, 0.0, 315.0);
            geoShapes.OutputPoints(FeatureType.enCylinder, "Cylinder-4-3", points, path + @"testcaseCylinder-4-3.txt");
            points.Clear();

            points = geoShapes.CreateCircle(center, radius, 60.0, 30.0, 0.0, 0.0);
            geoShapes.OutputPoints(FeatureType.enCircle, "Circle-1", points, path + @"testcaseCircle-1.txt");
            Vector3D center1 = geoShapes.RotateVector(30.0, 0.0, 0.0, center);
            Vector3D center2 = new Vector3D(0.0, radius, 0.0);

            center2 = geoShapes.RotateVector(30.0, 0.0, 0.0, center2);
            points.Clear();

            center.X = 1.0; center.Y = 2.0; center.Z = 3.0;
            points   = geoShapes.CreateCircle(center, radius, 90.0, 30.0, 0.0, 0.0);
            geoShapes.OutputPoints(FeatureType.enCircle, "Circle-2", points, path + @"testcaseCircle-2.txt");
            points.Clear();

            points = geoShapes.CreateCircle(center, radius, 30.0, 0.0, 30.0, 0.0);
            geoShapes.OutputPoints(FeatureType.enCircle, "Circle-3", points, path + @"testcaseCircle-3.txt");
            points.Clear();

            points = geoShapes.CreateCircle(center, radius, 30.0, 30.0, 0.0, 0.0);
            geoShapes.OutputPoints(FeatureType.enCircle, "Circle-4", points, path + @"testcaseCircle-4.txt");
            points.Clear();

            center.X = 0.0; center.Y = 0.0; center.Z = 0.0;
            points   = geoShapes.CreateCone(center, 2.0, 4.0, 2.0, 90, 0.0, 0.0, 0.0);
            geoShapes.OutputPoints(FeatureType.enCone, "Cone-1A", points, path + @"testcaseCone-1A.txt");
            points.Clear();

            center.X = 1.5; center.Y = 2.5; center.Z = 0.0;
            points   = geoShapes.CreateCone(center, 2.0, 4.0, 2.0, 90, 0.0, 0.0, 0.0);
            geoShapes.OutputPoints(FeatureType.enCone, "Cone-1", points, path + @"testcaseCone-1.txt");
            points.Clear();

            points = geoShapes.CreateCone(center, 2.0, 4.0, 2.0, 60, 0.0, 0.0, 0.0);
            geoShapes.OutputPoints(FeatureType.enCone, "Cone-1-a", points, path + @"testcaseCone-1-a.txt");
            points.Clear();

            points = geoShapes.CreateCone(center, 2.0, 4.0, 4.0, 90, 0.0, 0.0, 0.0);
            geoShapes.OutputPoints(FeatureType.enCone, "Cone-1-1", points, path + @"testcaseCone-1-1.txt");
            points.Clear();

            points = geoShapes.CreateCone(center, 2.0, 4.0, 4.0, 90, 90.0, 0.0, 0.0);
            geoShapes.OutputPoints(FeatureType.enCone, "Cone-2", points, path + @"testcaseCone-2.txt");
            points.Clear();

            points = geoShapes.CreateCone(center, 2.0, 4.0, 4.0, 90, 0.0, 90.0, 0.0);
            geoShapes.OutputPoints(FeatureType.enCone, "Cone-3", points, path + @"testcaseCone-3.txt");
            points.Clear();

            points = geoShapes.CreateCone(center, 2.0, 4.0, 4.0, 90, 30.0, 0.0, 0.0);
            geoShapes.OutputPoints(FeatureType.enCone, "Cone-4", points, path + @"testcaseCone-4.txt");
            points.Clear();

            points = geoShapes.CreateCone(center, 2.0, 4.0, 4.0, 90, -30.0, 0.0, 0.0);
            geoShapes.OutputPoints(FeatureType.enCone, "Cone-4-1", points, path + @"testcaseCone-4-1.txt");
            points.Clear();

            points = geoShapes.CreateCone(center, 2.0, 4.0, 4.0, 90, 0.0, 30.0, 0.0);
            geoShapes.OutputPoints(FeatureType.enCone, "Cone-5", points, path + @"testcaseCone-5.txt");
            points.Clear();

            points = geoShapes.CreateCone(center, 2.0, 4.0, 4.0, 90, 0.0, -30.0, 0.0);
            geoShapes.OutputPoints(FeatureType.enCone, "Cone-5-1", points, path + @"testcaseCone-5-1.txt");
            points.Clear();

            points = geoShapes.CreateCone(center, 2.0, 4.0, 4.0, 90, 30.0, 30.0, 0.0);
            geoShapes.OutputPoints(FeatureType.enCone, "Cone-6", points, path + @"testcaseCone-6.txt");
            points.Clear();

            center.X = 1.5; center.Y = 2.5; center.Z = 2.0;
            points   = geoShapes.CreateCone(center, 2.0, 4.0, 4.0, 60.0, 54.7356, 0.0, 45.0);
            geoShapes.OutputPoints(FeatureType.enCone, "Cone-7", points, path + @"testcaseCone-7.txt");
            points.Clear();
            // origin
            center.X = 0.0; center.Y = 0.0; center.Z = 0.0;
            points   = geoShapes.CreateCone(center, 2.0, 4.0, 4.0, 60.0, 54.7356, 0.0, 45.0);
            geoShapes.OutputPoints(FeatureType.enCone, "Cone-1-a", points, path + @"testcaseCone-1-a.txt");
            points.Clear();

            points = geoShapes.CreateCone(center, 2.0, 4.0, 2.0, 60, 0.0, 0.0, 0.0);
            geoShapes.OutputPoints(FeatureType.enCone, "Cone-1-b", points, path + @"testcaseCone-1-b.txt");
            points.Clear();

            center.X = 1.5; center.Y = 2.5; center.Z = 4.0;
            points   = geoShapes.CreateSphere(center, 2.0, 120.0, 120.0);
            geoShapes.OutputPoints(FeatureType.enCone, "Sphere-1", points, path + @"testcaseSphere-1.txt");
            points.Clear();

            center.X = 0.0; center.Y = 0.0; center.Z = 2.0;
            points   = geoShapes.CreatePlane(center, 4.0, 4.0, 0.0, 0.0, 0.0);
            geoShapes.OutputPoints(FeatureType.enPlane, "Plane-1", points, path + @"testcasePlane-1.txt");
            points.Clear();

            center.X = 0.0; center.Y = 0.0; center.Z = 2.0;
            points   = geoShapes.CreatePlane(center, 4.0, 4.0, 30.0, 0.0, 0.0);
            geoShapes.OutputPoints(FeatureType.enPlane, "Plane-2", points, path + @"testcasePlane-2.txt");
            points.Clear();

            center.X = 0.0; center.Y = 0.0; center.Z = 2.0;
            points   = geoShapes.CreatePlane(center, 4.0, 4.0, -30.0, 0.0, 0.0);
            geoShapes.OutputPoints(FeatureType.enPlane, "Plane-2-1", points, path + @"testcasePlane-2-1.txt");
            points.Clear();

            center.X = 0.0; center.Y = 0.0; center.Z = 2.0;
            points   = geoShapes.CreatePlane(center, 4.0, 4.0, 0.0, 30.0, 0.0);
            geoShapes.OutputPoints(FeatureType.enPlane, "Plane-3", points, path + @"testcasePlane-3.txt");
            points.Clear();

            center.X = 0.0; center.Y = 0.0; center.Z = 2.0;
            points   = geoShapes.CreatePlane(center, 4.0, 4.0, 0.0, -30.0, 0.0);
            geoShapes.OutputPoints(FeatureType.enPlane, "Plane-3-1", points, path + @"testcasePlane-3-1.txt");
            points.Clear();

            center.X = 2.0; center.Y = 2.0; center.Z = 2.0;
            points   = geoShapes.CreatePlane(center, 4.0, 4.0, 54.7356, 0.0, 45.0);
            geoShapes.OutputPoints(FeatureType.enPlane, "Plane-4", points, path + @"testcasePlane-4.txt");
            points.Clear();

            center.X = 1.5; center.Y = 2.0; center.Z = 2.0;
            points   = geoShapes.CreatePlane(center, 4.0, 4.0, 0.0, -90.0, 0.0);
            geoShapes.OutputPoints(FeatureType.enPlane, "Plane-5", points, path + @"testcasePlane-5.txt");
            points.Clear();

            center.X = 5.0; center.Y = 2.0; center.Z = 2.0;
            points   = geoShapes.CreatePlane(center, 4.0, 4.0, 0.0, 90.0, 0.0);
            geoShapes.OutputPoints(FeatureType.enPlane, "Plane-6", points, path + @"testcasePlane-6.txt");
            points.Clear();

            center.X = 5.0; center.Y = 6.0; center.Z = 2.0;
            points   = geoShapes.CreatePlane(center, 4.0, 4.0, 90.0, 0.0, 0.0);
            geoShapes.OutputPoints(FeatureType.enPlane, "Plane-7", points, path + @"testcasePlane-7.txt");
            points.Clear();

            center.X = 5.0; center.Y = 6.0; center.Z = 2.0;
            points   = geoShapes.CreatePlane(center, 4.0, 4.0, 89.9, 0.0, 0.0);
            geoShapes.OutputPoints(FeatureType.enPlane, "Plane-8", points, path + @"testcasePlane-8.txt");
            points.Clear();
        }