public void RubberbandRectangleTouchedSelection()
        {
            var ctx = Context.Current;
            var sel = ctx.WorkspaceController.Selection;

            var body1 = Body.Create(Box.Create(10, 10, 10));

            body1.Position = new Pnt(-15, 0, 0);
            var body2 = Body.Create(Cylinder.Create(6, 8));

            body2.Position = new Pnt(15, 0, 0);
            var body3 = Body.Create(Sphere.Create(8));

            body2.Position = new Pnt(0, 15, 0);
            ctx.ViewportController.ZoomFitAll();

            Assert.Multiple(() =>
            {
                // Select two of three
                ctx.MoveTo(400, 400);
                ctx.ViewportController.MouseDown();
                ctx.ViewportController.StartRubberbandSelection(ViewportController.RubberbandSelectionMode.Rectangle, true);
                ctx.MoveTo(170, 270);
                AssertHelper.IsSameViewport(Path.Combine(_BasePath, "RubberbandSelection31"));

                ctx.ViewportController.MouseUp(false);
                AssertHelper.IsSameViewport(Path.Combine(_BasePath, "RubberbandSelection32"));
                Assert.AreEqual(2, sel.SelectedEntities.Count);
            });
        }
Exemplo n.º 2
0
        private static void RunFireworks2012()
        {
            // 1. Define a problem to solve
            Problem problem = Sphere.Create();

            // 2. Setup algorithm stop condition
            CounterStopCondition stopCondition = new CounterStopCondition(10000);

            problem.QualityCalculated += stopCondition.IncrementCounter;

            // 3. Initialize algorithm run settings
            FireworksAlgorithmSettings2012 settings = new FireworksAlgorithmSettings2012
            {
                LocationsNumber = 8,
                ExplosionSparksNumberModifier    = 50.0,
                ExplosionSparksNumberLowerBound  = 0.04,
                ExplosionSparksNumberUpperBound  = 0.8,
                ExplosionSparksMaximumAmplitude  = 40.0,
                SpecificSparksNumber             = 8,
                SpecificSparksPerExplosionNumber = 1,
                FunctionOrder  = 2,
                SamplingNumber = 5
            };

            // 4. Instantiate desired implementation of the algorithm (per 2012 paper in this case)
            IFireworksAlgorithm fwa2012 = new FireworksAlgorithm2012(problem, stopCondition, settings);

            // 5. Finally, find a solution
            Solution solution = fwa2012.Solve();
        }
Exemplo n.º 3
0
        public void RemoveReferencedBody()
        {
            void __CreateTwoBodiesAndRemoveOne()
            {
                Context.InitWithDefault();
                var model   = CoreContext.Current.Document;
                var boxBody = Body.Create(Box.Create(20, 20, 10));

                boxBody.Position = new Pnt(-10, -10, 0);
                model.Add(boxBody);

                var cylBody = Body.Create(Sphere.Create(20));

                cylBody.Position = new Pnt(-15, 0, 0);
                model.Add(cylBody);

                BooleanCut.Create(boxBody, new BodyShapeOperand(cylBody));

                model.SafeDelete(new[] { cylBody });
            }

            __CreateTwoBodiesAndRemoveOne();

            dotMemory.Check(memory =>
            {
                Assert.AreEqual(1, memory.ObjectsCount <Body>(), "Body is alive");
                Assert.AreEqual(1, memory.ObjectsCount <Solid>(), "Solid not found");
                Assert.AreEqual(0, memory.ObjectsCount <Sphere>(), "Sphere is alive");
            });
        }
Exemplo n.º 4
0
        public static Scene CreateAndPopulateScene()
        {
            var scene = new Scene();

            var cube = Cube.Create(10.0);

            cube.Frame = Matrix44D.CreateTranslation(new Vector3D(0, 0, 5));
            scene.Bodies.Add(cube);

            var cube2 = Cube.Create(10.0);

            cube2.Frame  = Matrix44D.CreateTranslation(new Vector3D(0, 0, 15)) * Matrix44D.CreateRotation(new Vector3D(0, 0, 1), 45.0.DegToRad());;
            cube2.Sensor = new CylinderSensor(new Vector3D(0, 0, 1));
            scene.Bodies.Add(cube2);

            var cylinder = Cylinder.Create(16, 4.0, 10.0);

            cylinder.Frame  = Matrix44D.CreateTranslation(new Vector3D(10, 10, 5.1));
            cylinder.Sensor = new LinearSensor(new Vector3D(0, 1, 0));
            scene.Bodies.Add(cylinder);

            var floor = Floor.Create(4, 20);

            scene.Bodies.Add(floor);


            double[][] segments = new double[][]
            {
                new [] { 0.0, 0.0, 5.0, 0.0 },
                new [] { 5.0, 0.0, 5.0, 1.0 },
                new [] { 5.0, 1.0, 1.0, 5.0 },
                new [] { 1.0, 5.0, 1.0, 7.0 },
                new [] { 1.0, 7.0, 5.0, 11.0 },
                new [] { 5.0, 11.0, 5.0, 12.0 },
                new [] { 5.0, 12.0, 0.0, 12.0 },
            };
            bool[] borderFlags = new bool[] { true, true, true, true, true, true, true };
            bool[] facetsFlags = new bool[] { false, false, false, false, false, false, false };

            var rotationBody = RotationBody.Create(16, segments, borderFlags, facetsFlags);

            rotationBody.Sensor = new PlaneSensor(new Vector3D(0, 0, 1));
            rotationBody.Frame  = Matrix44D.CreateTranslation(new Vector3D(30, -30, 0.1));
            scene.Bodies.Add(rotationBody);

            var sphere = Sphere.Create(16, 8);

            sphere.Sensor = new SphereSensor();
            sphere.Frame  = Matrix44D.CreateTranslation(new Vector3D(-30, 30, 10));
            scene.Bodies.Add(sphere);

            return(scene);
        }
        public void RubberbandRectangleSelection()
        {
            var ctx = Context.Current;
            var sel = ctx.WorkspaceController.Selection;

            var body1 = Body.Create(Box.Create(10, 10, 10));

            body1.Position = new Pnt(-15, 0, 0);
            var body2 = Body.Create(Cylinder.Create(6, 8));

            body2.Position = new Pnt(15, 0, 0);
            var body3 = Body.Create(Sphere.Create(8));

            body2.Position = new Pnt(0, 15, 0);
            ctx.ViewportController.ZoomFitAll();

            // Select two of three
            ctx.MoveTo(170, 30);
            ctx.ViewportController.MouseDown();
            ctx.ViewportController.StartRubberbandSelection(ViewportController.RubberbandSelectionMode.Rectangle, false);
            ctx.MoveTo(400, 400);
            AssertHelper.IsSameViewport(Path.Combine(_BasePath, "RubberbandSelection01"));

            ctx.ViewportController.MouseUp(false);
            AssertHelper.IsSameViewport(Path.Combine(_BasePath, "RubberbandSelection02"));
            Assert.AreEqual(2, sel.SelectedEntities.Count);

            // Additional selection
            ctx.MoveTo(30, 120);
            ctx.ViewportController.MouseDown();
            ctx.ViewportController.StartRubberbandSelection(ViewportController.RubberbandSelectionMode.Rectangle, false);
            ctx.MoveTo(290, 420);
            ctx.ViewportController.MouseUp(true);
            Assert.AreEqual(3, sel.SelectedEntities.Count);

            // Reduce selection
            ctx.MoveTo(30, 120);
            ctx.ViewportController.MouseDown();
            ctx.ViewportController.StartRubberbandSelection(ViewportController.RubberbandSelectionMode.Rectangle, false);
            ctx.MoveTo(290, 420);
            ctx.ViewportController.MouseUp(false);
            Assert.AreEqual(1, sel.SelectedEntities.Count);

            // Empty selection
            ctx.MoveTo(10, 10);
            ctx.ViewportController.MouseDown();
            ctx.ViewportController.StartRubberbandSelection(ViewportController.RubberbandSelectionMode.Rectangle, false);
            ctx.MoveTo(100, 100);
            ctx.ViewportController.MouseUp(false);
            Assert.AreEqual(0, sel.SelectedEntities.Count);
        }
Exemplo n.º 6
0
        private void BasicScene()
        {
            this.lookFrom = new Vector3(12, 5, 3);
            this.lookat   = new Vector3(0, 0, 0);
            float dist_to_focus = 12;
            float aperture      = 0.2f;

            this.cam = Camera.Create(lookFrom, lookat, Vector3.UnitY, 25f, (float)this.width / this.height, aperture, dist_to_focus);

            spheres = new[]
            {
                Sphere.Create(new Vector3(0, 0.3f, 0), 0.8f),
                Sphere.Create(new Vector3(0, -0.2f, -1), 0.3f),
                Sphere.Create(new Vector3(1.4f, -0.1f, 1.3f), 0.4f),
                Sphere.Create(new Vector3(0.5f, -0.2f, 1), 0.3f),
                Sphere.Create(new Vector3(-1.5f, 0.1f, -1.6f), 0.6f),
                Sphere.Create(new Vector3(-0.9f, -0.2f, -0.7f), 0.3f),
                Sphere.Create(new Vector3(-1.4f, 0, 1f), 0.5f),
                Sphere.Create(new Vector3(1.3f, 0, -0.9f), 0.5f),
                Sphere.Create(new Vector3(1.6f, 0, 2.3f), 0.5f),
                Sphere.Create(new Vector3(2.1f, 0.2f, 0.1f), 0.7f),

                Sphere.Create(new Vector3(0, -100.5f, -1), 100f),
            };

            materials = new[]
            {
                Material.Create(new Vector3(0.6f, 0.2f, 0.8f), 0, MaterialType.Metal),
                Material.Create(new Vector3(0.8f, 0.1f, 0.1f), 0f, MaterialType.Lambertian),
                Material.Create(new Vector3(0.1f, 0.8f, 0.2f), 0f, MaterialType.Lambertian),
                Material.Create(new Vector3(0.4f, 0.1f, 0.5f), 0f, MaterialType.Lambertian),
                Material.Create(new Vector3(0.8f, 0.8f, 0.1f), 0.6f, MaterialType.Metal),
                Material.Create(new Vector3(0.8f, 0.8f, 0.8f), 0f, MaterialType.Lambertian),
                Material.Create(new Vector3(0.1f, 0.5f, 0.5f), 0f, MaterialType.Lambertian),
                Material.Create(new Vector3(0.8f, 0.1f, 0.5f), 0.2f, MaterialType.Metal),
                Material.Create(new Vector3(0.9f, 0.8f, 0.9f), 0.3f, MaterialType.Metal),
                Material.Create(new Vector3(0.9f, 0.8f, 0.9f), 1.1f, MaterialType.Dielectric),

                Material.Create(new Vector3(0.8f, 0.8f, 0.8f), 0, MaterialType.Lambertian),
            };
        }
Exemplo n.º 7
0
        // Creates all Spheres on the points found in method getSpherePoints
        public void createSpheres(List <SpherePoint> points, double multiplier)
        {
            int count = 1;

            foreach (SpherePoint point in points)
            {
                Direction dir   = Direction.Create(1, 1, 0);
                Frame     frame = Frame.Create(Point.Create(point.X, point.Y, point.Z), dir);

                //result += point.radius + ", ";

                Sphere sphere = Sphere.Create(frame, (point.radius * multiplier));

                BoxUV box = new BoxUV();

                Body body1 = Body.CreateSurfaceBody(sphere, box);

                DesignBody designBody = DesignBody.Create(Window.ActiveWindow.Document.MainPart, "Sphere" + count, body1);

                count++;
            }
        }
        public static IGroup Build()
        {
            var root = Group.Create();

            var model = CreateDragonModel();

            var geometryFactory = GeometryFactory.Create();

            var cube = geometryFactory.CreateCube(VertexType.Position3Texture2Color3Normal3,
                                                  TopologyType.IndexedTriangleList);

            // Shape Drawables
            var cubeShape = Box.Create(Vector3.Zero, 0.5f * Vector3.One);
            var hints     = TessellationHints.Create();

            hints.NormalsType = NormalsType.PerVertex;
            hints.ColorsType  = ColorsType.ColorPerVertex;

            var freq       = (float)(2 * System.Math.PI / 9);
            var cubeColors = MakeColorGradient(freq, freq, freq, 0, 2, 4, 8);

            var cubeDrawable =
                ShapeDrawable <Position3Texture2Color3Normal3> .Create(
                    cubeShape,
                    hints,
                    cubeColors.ToArray());

            var cube2 = Geode.Create();

            cube2.AddDrawable(cubeDrawable);

            var sphereShape = Sphere.Create(Vector3.Zero, 0.5f);
            var sphereHints = TessellationHints.Create();

            sphereHints.SetDetailRatio(1.6f);

            var sphereDrawable =
                ShapeDrawable <Position3Texture2Color3Normal3> .Create(
                    sphereShape,
                    sphereHints,
                    new Vector3[] { new Vector3(1.0f, 0.0f, 0.0f) });

            var sphere = Geode.Create();

            sphere.AddDrawable(sphereDrawable);

            var cubeXForm = MatrixTransform.Create(Matrix4x4.CreateScale(10f, 10f, 10f));

            cubeXForm.AddChild(sphere);

            var cubeXForm2 = MatrixTransform.Create(Matrix4x4.CreateScale(10f, 10f, 10f));

            cubeXForm2.AddChild(cube2);

            var leftTop  = MatrixTransform.Create(Matrix4x4.CreateTranslation(-10f, 10f, 0f));
            var rightTop = MatrixTransform.Create(Matrix4x4.CreateTranslation(10f, 10f, 0f));

            var leftBottom  = MatrixTransform.Create(Matrix4x4.CreateTranslation(-10f, -10f, 0f));
            var rightBottom = MatrixTransform.Create(Matrix4x4.CreateTranslation(10f, -10f, 0f));

            leftTop.AddChild(model);
            rightTop.AddChild(model);

            leftBottom.AddChild(cubeXForm);
            rightBottom.AddChild(cubeXForm2);

            var flatYellowMaterial = PhongMaterial.Create(
                PhongMaterialParameters.Create(
                    new Vector3(1.0f, 1.0f, 0.0f),
                    new Vector3(1.0f, 1.0f, 0.0f),
                    new Vector3(1.0f, 1.0f, 1.0f),
                    20),
                PhongPositionalLight.Create(new Vector4(0, 100, 0, 1), PhongLightParameters.Create(
                                                new Vector3(0.2f, 0.2f, 0.2f),
                                                new Vector3(0.2f, 0.2f, 0.2f),
                                                new Vector3(1.0f, 1.0f, 1.0f),
                                                300f,
                                                1)));

            var shinyRedGoldMaterial = PhongMaterial.Create(
                PhongMaterialParameters.Create(
                    new Vector3(1.0f, 1.0f, 0.0f),
                    new Vector3(1.0f, 1.0f, 0.0f),
                    new Vector3(1.0f, 1.0f, 1.0f),
                    5),
                PhongHeadlight.Create(PhongLightParameters.Create(
                                          new Vector3(0.1f, 0.1f, 0.1f),
                                          new Vector3(1.0f, 1.0f, 1.0f),
                                          new Vector3(1.0f, 1.0f, 1.0f),
                                          30f,
                                          1)),
                false);

            var cubeMaterial = PhongMaterial.Create(
                PhongMaterialParameters.Create(
                    new Vector3(1.0f, 1.0f, 1.0f),
                    new Vector3(1.0f, 1.0f, 1.0f),
                    new Vector3(1.0f, 1.0f, 1.0f),
                    50f),
                PhongHeadlight.Create(PhongLightParameters.Create(
                                          new Vector3(0.5f, 0.5f, 0.5f),
                                          new Vector3(1.0f, 1.0f, 1.0f),
                                          new Vector3(1.0f, 1.0f, 1.0f),
                                          1f,
                                          0)),
                false);

            var sphereMaterial = PhongMaterial.Create(
                PhongMaterialParameters.Create(
                    new Vector3(0.0f, 0.0f, 1.0f),
                    new Vector3(0.0f, 0.0f, 1.0f),
                    new Vector3(1.0f, 1.0f, 1.0f),
                    5f),
                PhongPositionalLight.Create(new Vector4(0, 10, 0, 1), PhongLightParameters.Create(
                                                new Vector3(0.1f, 0.1f, 0.1f),
                                                new Vector3(1.0f, 1.0f, 1.0f),
                                                new Vector3(1.0f, 1.0f, 1.0f),
                                                10000f,
                                                2)),
                true);

            leftTop.PipelineState  = flatYellowMaterial.CreatePipelineState();
            rightTop.PipelineState = shinyRedGoldMaterial.CreatePipelineState();
            sphere.PipelineState   = sphereMaterial.CreatePipelineState();
            cube2.PipelineState    = cubeMaterial.CreatePipelineState();
//            rightTop.PipelineState = CreateHeadlightState(
//                new Vector3(1.0f, 1.0f, 0.0f),
//                50,
//                Vector3.One,
//                5);

            var sceneGroup = Group.Create();

            sceneGroup.AddChild(leftTop);
            sceneGroup.AddChild(rightTop);
            sceneGroup.AddChild(leftBottom);
            sceneGroup.AddChild(rightBottom);

            root.AddChild(sceneGroup);

            return(root);
        }
        protected override void OnExecute(Command command, ExecutionContext context, System.Drawing.Rectangle buttonRect)
        {
            Part part = Window.ActiveWindow.Scene as Part;

            Debug.Assert(part != null);

            Double stepSize = 0.001;
            string tessellateLoftResolutionPropertyName = "Loft Tessellation Resolution";

            if (!part.Document.CustomProperties.ContainsKey(tessellateLoftResolutionPropertyName))
            {
                CustomProperty.Create(part.Document, tessellateLoftResolutionPropertyName, stepSize);
            }

            CustomProperty property;

            if (part.Document.CustomProperties.TryGetValue(tessellateLoftResolutionPropertyName, out property))
            {
                stepSize = (double)property.Value;
            }

            List <ITrimmedCurve> curves = new List <ITrimmedCurve>(Window.ActiveWindow.GetAllSelectedITrimmedCurves());

            if (curves.Count < 3)
            {
                return;
            }

            Point startPoint = curves[0].StartPoint;

            if (curves[1].StartPoint != startPoint)
            {
                if (curves[1].StartPoint != startPoint)
                {
                    curves[0] = CurveSegment.Create(curves[0].GetGeometry <Curve>(), Interval.Create(curves[0].Bounds.End, curves[0].Bounds.Start)); // TBD Figure out why we can't call ReverseCurves and debug
                }
                else
                {
                    curves[1] = CurveSegment.Create(curves[1].GetGeometry <Curve>(), Interval.Create(curves[1].Bounds.End, curves[1].Bounds.Start));
                }
            }

            for (int i = 2; i < curves.Count; i++)
            {
                if (curves[i].StartPoint != startPoint)
                {
                    curves[i] = CurveSegment.Create(curves[i].GetGeometry <Curve>(), Interval.Create(curves[i].Bounds.End, curves[i].Bounds.Start));
                }

                if (curves[i].StartPoint != startPoint)
                {
                    return;
                }
            }

            double endZ = double.NegativeInfinity;

            foreach (ITrimmedCurve curve in curves)
            {
                if (curve.EndPoint.Z > endZ)
                {
                    endZ = curve.EndPoint.Z;
                }
            }

            Plane  startPlane = Plane.Create(Frame.Create(startPoint, Direction.DirX, Direction.DirY));
            double cuttingZ   = startPoint.Z;
            List <List <Point> > curveSteps = new List <List <Point> >();
            List <List <Point> > insetSteps = new List <List <Point> >();

            while (true)
            {
                cuttingZ -= stepSize;
                if (cuttingZ < endZ)
                {
                    break;
                }

                Plane        cuttingPlane = Plane.Create(Frame.Create(Point.Create(startPoint.X, startPoint.Y, cuttingZ), Direction.DirX, Direction.DirY));
                List <Point> curvePoints  = new List <Point>();
                List <Point> planarPoints = new List <Point>();
                foreach (ITrimmedCurve curve in curves)
                {
                    ICollection <IntPoint <SurfaceEvaluation, CurveEvaluation> > surfaceIntersections = cuttingPlane.IntersectCurve(curve.GetGeometry <Curve>());
                    foreach (IntPoint <SurfaceEvaluation, CurveEvaluation> surfaceIntersection in surfaceIntersections)
                    {
                        Point point = surfaceIntersection.Point;
                        curvePoints.Add(point);

                        Point     projectedPoint = startPlane.ProjectPoint(point).Point;
                        Direction direction      = (projectedPoint - startPoint).Direction;
                        double    length         = CurveSegment.Create(curve.GetGeometry <Curve>(), Interval.Create(curve.Bounds.Start, surfaceIntersection.EvaluationB.Param)).Length;
                        planarPoints.Add(startPoint + direction * length);

                        break; // assume one intersection
                    }
                }

                List <Point> insetPoints = new List <Point>();
                for (int i = 0; i < planarPoints.Count; i++)
                {
                    int ii = i == planarPoints.Count - 1 ? 0 : i + 1;

                    ICollection <Point> pointCandidates = AddInHelper.IntersectSpheres(new Sphere[] {
                        Sphere.Create(Frame.Create(startPoint, Direction.DirX, Direction.DirY), ((startPoint - curvePoints[i]).Magnitude + (startPoint - curvePoints[ii]).Magnitude) / 2),
                        Sphere.Create(Frame.Create(curvePoints[i], Direction.DirX, Direction.DirY), (startPoint - curvePoints[i]).Magnitude),
                        Sphere.Create(Frame.Create(curvePoints[ii], Direction.DirX, Direction.DirY), (startPoint - curvePoints[ii]).Magnitude)
                    });

                    Point planarMidPoint = Point.Origin + (planarPoints[i] + planarPoints[ii].Vector).Vector / 2;
                    Point insetPoint;
                    foreach (Point point in pointCandidates)
                    {
                        Point testPoint = startPlane.ProjectPoint(point).Point;

                        if ((testPoint - planarMidPoint).Magnitude < (insetPoint - planarMidPoint).Magnitude)
                        {
                            insetPoint = point;
                        }
                    }

                    insetPoints.Add(insetPoint);
                }

                curveSteps.Add(curvePoints);
                insetSteps.Add(insetPoints);
            }

            for (int i = 0; i < curveSteps.Count - 1; i++)
            {
                for (int j = 0; j < curveSteps[i].Count; j++)
                {
                    int jj = j == curveSteps[i].Count - 1 ? 0 : j + 1;

                    ShapeHelper.CreatePolygon(new Point[] { curveSteps[i][j], curveSteps[i + 1][j], insetSteps[i][j] }, 0, null);
                    ShapeHelper.CreatePolygon(new Point[] { curveSteps[i + 1][j], insetSteps[i][j], insetSteps[i + 1][j] }, 0, null);
                    ShapeHelper.CreatePolygon(new Point[] { insetSteps[i][j], insetSteps[i + 1][j], curveSteps[i][jj] }, 0, null);
                    ShapeHelper.CreatePolygon(new Point[] { insetSteps[i + 1][j], curveSteps[i][jj], curveSteps[i + 1][jj] }, 0, null);
                }
            }

            return;
        }
Exemplo n.º 10
0
    // Token: 0x060041A6 RID: 16806 RVA: 0x0014C3B4 File Offset: 0x0014A7B4
    public void OnButtonHit(int id)
    {
        this.animTimeout = this.animTimeMax;
        BaseObject baseObject = null;

        switch (id)
        {
        case 0:
        {
            baseObject = Triangle.Create(1f, 0);
            float[] array = new float[6];
            array[0]            = 4f;
            array[1]            = 4f;
            this.shapeParamsMax = array;
            float[] array2 = new float[6];
            array2[0]             = 1f;
            array2[1]             = 1f;
            this.shapeParamsStart = array2;
            break;
        }

        case 1:
            baseObject          = PlaneObject.Create(1f, 1f, 1, 1);
            this.shapeParamsMax = new float[]
            {
                4f,
                4f,
                1f,
                1f,
                0f,
                0f
            };
            this.shapeParamsStart = new float[]
            {
                1f,
                1f,
                1f,
                1f,
                0f,
                0f
            };
            break;

        case 2:
        {
            baseObject = Circle.Create(1f, 3);
            float[] array3 = new float[6];
            array3[0]           = 2.5f;
            array3[1]           = 40f;
            this.shapeParamsMax = array3;
            float[] array4 = new float[6];
            array4[0]             = 1f;
            array4[1]             = 3f;
            this.shapeParamsStart = array4;
            break;
        }

        case 3:
            baseObject          = Ellipse.Create(1f, 0.5f, 3);
            this.shapeParamsMax = new float[]
            {
                2.5f,
                1.2f,
                40f,
                0f,
                0f,
                0f
            };
            this.shapeParamsStart = new float[]
            {
                1f,
                0.5f,
                3f,
                0f,
                0f,
                0f
            };
            break;

        case 4:
            baseObject          = Ring.Create(0.5f, 1f, 3);
            this.shapeParamsMax = new float[]
            {
                1f,
                2.5f,
                40f,
                0f,
                0f,
                0f
            };
            this.shapeParamsStart = new float[]
            {
                0.5f,
                1f,
                3f,
                0f,
                0f,
                0f
            };
            break;

        case 5:
            baseObject          = Box.Create(1f, 1f, 1f, 1, 1, 1, false, null, PivotPosition.Botttom);
            this.shapeParamsMax = new float[]
            {
                2.5f,
                2.5f,
                2.5f,
                1f,
                1f,
                1f
            };
            this.shapeParamsStart = new float[]
            {
                1f,
                1f,
                1f,
                1f,
                1f,
                1f
            };
            break;

        case 6:
            baseObject          = Cylinder.Create(1f, 3f, 3, 1, (!this.flatNormals) ? NormalsType.Vertex : NormalsType.Face, PivotPosition.Botttom);
            this.shapeParamsMax = new float[]
            {
                1.25f,
                4f,
                40f,
                1f,
                0f,
                0f,
                0f
            };
            this.shapeParamsStart = new float[]
            {
                1f,
                3f,
                3f,
                1f,
                0f,
                0f,
                0f
            };
            break;

        case 7:
            baseObject          = Cone.Create(1f, 0f, 0f, 2f, 3, 10, (!this.flatNormals) ? NormalsType.Vertex : NormalsType.Face, PivotPosition.Botttom);
            this.shapeParamsMax = new float[]
            {
                1.25f,
                0f,
                4f,
                40f,
                10f,
                0f,
                0f
            };
            this.shapeParamsStart = new float[]
            {
                1f,
                1f,
                2f,
                3f,
                10f,
                0f,
                0f
            };
            break;

        case 8:
        {
            baseObject = Sphere.Create(1f, 4, 0f, 0f, 0f, (!this.flatNormals) ? NormalsType.Vertex : NormalsType.Face, PivotPosition.Botttom);
            float[] array5 = new float[6];
            array5[0]           = 2.25f;
            array5[1]           = 40f;
            this.shapeParamsMax = array5;
            float[] array6 = new float[6];
            array6[0]             = 1f;
            array6[1]             = 4f;
            this.shapeParamsStart = array6;
            break;
        }

        case 9:
            baseObject          = Ellipsoid.Create(1f, 1f, 1f, 4, (!this.flatNormals) ? NormalsType.Vertex : NormalsType.Face, PivotPosition.Botttom);
            this.shapeParamsMax = new float[]
            {
                1.25f,
                2.45f,
                2.5f,
                40f,
                0f,
                0f,
                0f
            };
            this.shapeParamsStart = new float[]
            {
                1f,
                1f,
                1f,
                4f,
                0f,
                0f,
                0f
            };
            break;

        case 10:
            baseObject          = Pyramid.Create(1f, 1f, 1f, 1, 1, 1, false, PivotPosition.Botttom);
            this.shapeParamsMax = new float[]
            {
                2.7f,
                2.7f,
                1.7f,
                1f,
                1f,
                1f,
                0f,
                0f,
                0f
            };
            this.shapeParamsStart = new float[]
            {
                1f,
                1f,
                1f,
                1f,
                1f,
                1f,
                0f,
                0f,
                0f
            };
            break;

        case 11:
        {
            baseObject = GeoSphere.Create(1f, 0, GeoSpherePrimitive.BaseType.Icosahedron, (!this.flatNormals) ? NormalsType.Vertex : NormalsType.Face, PivotPosition.Botttom);
            float[] array7 = new float[6];
            array7[0]           = 2.45f;
            array7[1]           = 4f;
            this.shapeParamsMax = array7;
            float[] array8 = new float[6];
            array8[0]             = 1f;
            this.shapeParamsStart = array8;
            break;
        }

        case 12:
            baseObject          = Tube.Create(0.8f, 1f, 1f, 3, 1, 0f, false, (!this.flatNormals) ? NormalsType.Vertex : NormalsType.Face, PivotPosition.Botttom);
            this.shapeParamsMax = new float[]
            {
                0.8f,
                1.5f,
                4f,
                40f,
                0f,
                0f,
                0f,
                0f
            };
            this.shapeParamsStart = new float[]
            {
                0.8f,
                1f,
                1f,
                3f,
                0f,
                0f,
                0f,
                0f
            };
            break;

        case 13:
            baseObject          = Capsule.Create(1f, 1f, 4, 1, false, (!this.flatNormals) ? NormalsType.Vertex : NormalsType.Face, PivotPosition.Botttom);
            this.shapeParamsMax = new float[]
            {
                1.2f,
                4f,
                40f,
                1f,
                0f,
                0f,
                0f
            };
            this.shapeParamsStart = new float[]
            {
                1f,
                1f,
                4f,
                1f,
                0f,
                0f,
                0f
            };
            break;

        case 14:
            baseObject          = RoundedCube.Create(1f, 1f, 1f, 1, 0.2f, (!this.flatNormals) ? NormalsType.Vertex : NormalsType.Face, PivotPosition.Botttom);
            this.shapeParamsMax = new float[]
            {
                1.6f,
                1.6f,
                1.6f,
                20f,
                0.6f,
                0f,
                0f,
                0f
            };
            this.shapeParamsStart = new float[]
            {
                1f,
                1f,
                1f,
                1f,
                0.2f,
                0f,
                0f,
                0f
            };
            break;

        case 15:
            baseObject          = Torus.Create(1f, 0.5f, 4, 4, 0f, (!this.flatNormals) ? NormalsType.Vertex : NormalsType.Face, PivotPosition.Botttom);
            this.shapeParamsMax = new float[]
            {
                1.6f,
                0.8f,
                40f,
                40f,
                0f,
                0f,
                0f
            };
            this.shapeParamsStart = new float[]
            {
                1f,
                0.5f,
                4f,
                4f,
                0f,
                0f,
                0f
            };
            break;

        case 16:
            baseObject          = TorusKnot.Create(0.5f, 0.3f, 10, 4, 2, 3, (!this.flatNormals) ? NormalsType.Vertex : NormalsType.Face, PivotPosition.Botttom);
            this.shapeParamsMax = new float[]
            {
                1f,
                0.5f,
                120f,
                40f,
                2f,
                3f,
                0f,
                0f,
                0f
            };
            this.shapeParamsStart = new float[]
            {
                0.5f,
                0.3f,
                10f,
                4f,
                2f,
                3f,
                0f,
                0f,
                0f
            };
            break;

        case 17:
            baseObject = Arc.Create(1f, 1f, 1f, 1f, 10, PivotPosition.Botttom);
            ((Arc)baseObject).gizmo.gameObject.transform.localPosition = new Vector3(-1f, -1f, 0f);
            this.shapeParamsMax = new float[]
            {
                4f,
                3f,
                2f,
                1f,
                20f,
                -1f
            };
            this.shapeParamsStart = new float[]
            {
                0.5f,
                0.5f,
                0.1f,
                0.5f,
                0f,
                0f
            };
            break;

        case 18:
            baseObject          = SphericalCone.Create(1f, 20, 180f, (!this.flatNormals) ? NormalsType.Vertex : NormalsType.Face, PivotPosition.Botttom);
            this.shapeParamsMax = new float[]
            {
                2f,
                40f,
                20f,
                0f,
                0f,
                0f
            };
            this.shapeParamsStart = new float[]
            {
                1f,
                20f,
                360f,
                0f,
                0f,
                0f
            };
            break;

        case 19:
            baseObject          = SuperEllipsoid.Create(1f, 1f, 1f, 20, 0.5f, 1f, (!this.flatNormals) ? NormalsType.Vertex : NormalsType.Face, PivotPosition.Botttom);
            this.shapeParamsMax = new float[]
            {
                2f,
                2f,
                2f,
                20f,
                0.5f,
                1f,
                0f,
                0f,
                0f
            };
            this.shapeParamsStart = new float[]
            {
                0.5f,
                0.5f,
                0.5f,
                1f,
                0f,
                0f,
                0f,
                0f,
                0f
            };
            break;

        case 20:
            this.textureToggle = !this.textureToggle;
            break;

        case 21:
            this.flatNormals = !this.flatNormals;
            break;
        }
        if (baseObject)
        {
            if (this.shapeOld)
            {
                UnityEngine.Object.Destroy(this.shapeOld.gameObject);
            }
            this.shapeOld  = this.shapeMain;
            this.shapeMain = baseObject;
            this.shapeMain.gameObject.GetComponent <Renderer>().material = new Material(this.GetSpecularShader());
            this.shapeMain.gameObject.GetComponent <Renderer>().material.SetColor("_Color", new Color(1f, 0.7058824f, 0.7058824f));
            this.shapeMain.gameObject.GetComponent <Renderer>().material.SetColor("_SpecColor", Color.white);
            this.shapeMain.gameObject.transform.position = this.prevPosition.position;
            this.nextShowTimeout = this.nextShowTimeoutMax;
            this.shapeID         = id;
        }
        if (this.textureToggle)
        {
            this.shapeMain.GetComponent <MeshRenderer>().sharedMaterial = (Resources.Load("Checker") as Material);
        }
        else
        {
            this.shapeMain.GetComponent <MeshRenderer>().sharedMaterial = new Material(this.GetSpecularShader());
            this.shapeMain.gameObject.GetComponent <Renderer>().material.SetColor("_Color", new Color(1f, 0.7058824f, 0.7058824f));
            this.shapeMain.gameObject.GetComponent <Renderer>().material.SetColor("_SpecColor", Color.white);
        }
    }