More dual contouring testing

This commit is contained in:
Lars Brubaker 2022-08-15 18:13:08 -07:00
parent 844b3fdb14
commit 7bf216ccdb
2 changed files with 68 additions and 14 deletions

View file

@ -59,7 +59,10 @@ namespace MatterHackers.MatterControl.DesignTools
public enum Shapes
{
Box,
Sphere
Union1,
Union2,
Sphere,
Cylinder,
}
public Shapes Shape { get; set; } = Shapes.Box;
@ -89,21 +92,72 @@ namespace MatterHackers.MatterControl.DesignTools
{
using (RebuildLock())
{
#if true
using (new CenterAndHeightMaintainer(this))
{
#if true
ISdf shape = new Sphere()
{
Radius = Size
};
ISdf shape = null;
switch (Shape)
{
case Shapes.Box:
shape = new Box()
{
Size = new Vector3(Size, Size, Size)
};
break;
if (Shape == Shapes.Box)
{
shape = new Box()
{
Size = new Vector3(Size, Size, Size)
};
}
case Shapes.Union1:
shape = new Union()
{
Items = new ISdf[]
{
new Transform(new Box()
{
Size = new Vector3(Size, Size, Size)
}, Matrix4X4.CreateRotationX(MathHelper.Tau * .2)),
new Box()
{
Size = new Vector3(Size, Size, Size)
},
new Transform(new Box()
{
Size = new Vector3(Size, Size, Size)
}, Matrix4X4.CreateRotationY(MathHelper.Tau * .2)),
}
};
break;
case Shapes.Union2:
shape = new Union()
{
Items = new ISdf[]
{
new Transform(new Sphere()
{
Radius = Size / 2
}, Matrix4X4.CreateTranslation(4, 0, 0)),
new Transform(new Box()
{
Size = new Vector3(Size, Size, Size)
}, Matrix4X4.CreateRotationY(MathHelper.Tau * .2)),
}
};
break;
case Shapes.Sphere:
shape = new Sphere()
{
Radius = Size
};
break;
case Shapes.Cylinder:
shape = new Cylinder()
{
Radius = Size,
Height = Size
};
break;
}
var bounds = shape.Bounds;
bounds.Expand(.1);

@ -1 +1 @@
Subproject commit c2b8646bf496a0ecf99338e513cf96cb6fdeed17
Subproject commit 3ae73a123c0d97a6ed9692bfcbf0599f4d904e84