Esempio n. 1
0
        public override void Run(RenderControl renderer)
        {
            var shape       = ShapeBuilder.MakeSphere(new GPnt(), 1);
            var bufferShape = new BufferShape(shape, null, null, 0.1);

            bufferShape.Build();

            float distance  = 3.0f;
            int   halfCount = 5;

            var scene = renderer.GetScene();

            for (int ii = -halfCount; ii < halfCount; ++ii)
            {
                for (int jj = -halfCount; jj < halfCount; ++jj)
                {
                    for (int kk = -halfCount; kk < halfCount; ++kk)
                    {
                        var node = new BrepSceneNode(bufferShape);
                        node.SetTransform(Matrix4.makeTranslation(ii * distance, jj * distance, kk * distance));
                        scene.AddNode(node);
                    }
                }
            }
            renderer.ZoomAll();

            Matrix4 m1 = new Matrix4(1);
            Matrix4 m2 = new Matrix4(1);
            Matrix4 x  = m1 * m2;
        }
Esempio n. 2
0
        public override bool OnParameterChanged(Element instance, ParameterDict parameters)
        {
            var shape  = CastShapeElement(instance);
            var radius = parameters.AsDouble("Radius", 5.0f);

            shape.SetShape(ShapeBuilder.MakeSphere(GP.Origin(), radius));
            return(true);
        }
Esempio n. 3
0
        public override void Run(RenderControl render)
        {
            var box    = ShapeBuilder.MakeBox(GP.XOY(), 10, 10, 10);
            var sphere = ShapeBuilder.MakeSphere(GP.Origin(), 5);

            render.ShowShape(box, Vector3.Red);
            render.ShowShape(sphere, Vector3.Blue);

            var common = BooleanTool.Common(box, sphere);

            render.ShowShape(common, Matrix4.makeTranslation(-20, 0, 0));

            var cut = BooleanTool.Cut(box, sphere);

            render.ShowShape(cut, Matrix4.makeTranslation(0, 20, 0));

            var cut2 = BooleanTool.Cut(sphere, box);

            render.ShowShape(cut2, Matrix4.makeTranslation(0, -20, 0));

            var fuse = BooleanTool.Fuse(box, sphere);

            render.ShowShape(fuse, Matrix4.makeTranslation(20, 0, 0));
        }