improving revolve

This commit is contained in:
LarsBrubaker 2020-10-11 15:57:00 -07:00
parent dcccf5fd9c
commit 574eed06cd
2 changed files with 11 additions and 11 deletions

View file

@ -44,7 +44,7 @@ using Newtonsoft.Json;
namespace MatterHackers.MatterControl.DesignTools
{
public class RevolveObject3D : Object3D, IObject3DControlsProvider
public class RevolveObject3D : Object3D
{
public double AxisPosition { get; set; } = 0;
@ -73,11 +73,6 @@ namespace MatterHackers.MatterControl.DesignTools
}
}
public void AddObject3DControls(Object3DControlsLayer object3DControlsLayer)
{
object3DControlsLayer.AddControls(ControlTypes.Standard2D);
}
public override void Flatten(UndoBuffer undoBuffer)
{
if (Mesh == null)
@ -161,23 +156,28 @@ namespace MatterHackers.MatterControl.DesignTools
var vertexSource = this.VertexSource;
var bounds = vertexSource.GetBounds();
vertexSource = vertexSource.Translate(-bounds.Left - AxisPosition, 0);
Mesh mesh = null;
if (!Advanced)
{
Mesh = VertexSourceToMesh.Revolve(vertexSource, Sides);
mesh = VertexSourceToMesh.Revolve(vertexSource, Sides);
}
else
{
Mesh = VertexSourceToMesh.Revolve(vertexSource,
mesh = VertexSourceToMesh.Revolve(vertexSource,
Sides,
MathHelper.DegreesToRadians(StartingAngle),
MathHelper.DegreesToRadians(EndingAngle));
}
if (Mesh.Vertices.Count == 0)
mesh.Transform(Matrix4X4.CreateTranslation(bounds.Left + AxisPosition, 0, -mesh.GetAxisAlignedBoundingBox().MinXYZ.Z));
if (mesh.Vertices.Count == 0)
{
Mesh = null;
mesh = null;
}
Mesh = mesh;
rebuildLock.Dispose();
Parent?.Invalidate(new InvalidateArgs(this, InvalidateType.Mesh));
return Task.CompletedTask;

@ -1 +1 @@
Subproject commit 3cd5c87f009f30e0fb867e9107a7eef31c2b9ad5
Subproject commit 49170baf0c5621c7b41099337c7c3328c94d2b62