Пример #1
0
        virtual protected DMesh3 make_shape_box()
        {
            Vector3d origin = new Vector3d(0, ShapeHeight / 2, 0);

            GridBox3Generator boxgen = new GridBox3Generator()
            {
                Box          = new Box3d(origin, new Vector3d(shape_width / 2, shape_height / 2, shape_depth / 2)),
                EdgeVertices = Subdivisions
            };

            return(boxgen.Generate().MakeDMesh());
        }
        public static void test_basic_generators()
        {
            TrivialDiscGenerator disc_gen = new TrivialDiscGenerator();

            disc_gen.Generate();
            WriteGeneratedMesh(disc_gen, "meshgen_Disc.obj");

            TrivialRectGenerator rect_gen = new TrivialRectGenerator();

            rect_gen.Generate();
            WriteGeneratedMesh(rect_gen, "meshgen_Rect.obj");

            GriddedRectGenerator gridrect_gen = new GriddedRectGenerator();

            gridrect_gen.Generate();
            WriteGeneratedMesh(gridrect_gen, "meshgen_GriddedRect.obj");

            PuncturedDiscGenerator punc_disc_gen = new PuncturedDiscGenerator();

            punc_disc_gen.Generate();
            WriteGeneratedMesh(punc_disc_gen, "meshgen_PuncturedDisc.obj");

            TrivialBox3Generator box_gen = new TrivialBox3Generator();
            Frame3f f = Frame3f.Identity;

            f.Rotate(Quaternionf.AxisAngleD(Vector3f.AxisY, 45.0f));
            f.Rotate(Quaternionf.AxisAngleD(Vector3f.AxisZ, 45.0f));
            box_gen.Box = new Box3d(f.Origin, f.X, f.Y, f.Z, new Vector3d(3, 2, 1));
            box_gen.Generate();
            WriteGeneratedMesh(box_gen, "meshgen_TrivialBox_shared.obj");
            box_gen.NoSharedVertices = true;
            box_gen.Generate();
            WriteGeneratedMesh(box_gen, "meshgen_TrivialBox_noshared.obj");


            RoundRectGenerator roundrect_gen = new RoundRectGenerator();

            roundrect_gen.Width = 2;
            roundrect_gen.Generate();
            WriteGeneratedMesh(roundrect_gen, "meshgen_RoundRect.obj");


            GridBox3Generator gridbox_gen = new GridBox3Generator();

            gridbox_gen.Generate();
            WriteGeneratedMesh(gridbox_gen, "meshgen_GridBox_shared.obj");
            gridbox_gen.NoSharedVertices = true;
            gridbox_gen.Generate();
            WriteGeneratedMesh(gridbox_gen, "meshgen_GridBox_noshared.obj");

            Sphere3Generator_NormalizedCube normcube_gen = new Sphere3Generator_NormalizedCube();

            normcube_gen.Generate();
            WriteGeneratedMesh(normcube_gen, "meshgen_Sphere_NormalizedCube_shared.obj");
            normcube_gen.NoSharedVertices = true;
            normcube_gen.Box = new Box3d(new Frame3f(Vector3f.One, Vector3f.One), Vector3d.One * 1.3);
            normcube_gen.Generate();
            WriteGeneratedMesh(normcube_gen, "meshgen_Sphere_NormalizedCube_noshared.obj");


            TubeGenerator tube_gen = new TubeGenerator()
            {
                Vertices = new List <Vector3d>()
                {
                    Vector3d.Zero, Vector3d.AxisX, 2 * Vector3d.AxisX, 3 * Vector3d.AxisX
                },
                Polygon = Polygon2d.MakeCircle(1, 16)
            };

            tube_gen.Generate();
            WriteGeneratedMesh(tube_gen, "meshgen_TubeGenerator.obj");

            tube_gen.Polygon.Translate(Vector2d.One);
            tube_gen.CapCenter = Vector2d.One;
            tube_gen.Generate();
            WriteGeneratedMesh(tube_gen, "meshgen_TubeGenerator_shifted.obj");
        }