improving revolve
This commit is contained in:
parent
dcccf5fd9c
commit
574eed06cd
2 changed files with 11 additions and 11 deletions
|
|
@ -44,7 +44,7 @@ using Newtonsoft.Json;
|
||||||
namespace MatterHackers.MatterControl.DesignTools
|
namespace MatterHackers.MatterControl.DesignTools
|
||||||
{
|
{
|
||||||
|
|
||||||
public class RevolveObject3D : Object3D, IObject3DControlsProvider
|
public class RevolveObject3D : Object3D
|
||||||
{
|
{
|
||||||
public double AxisPosition { get; set; } = 0;
|
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)
|
public override void Flatten(UndoBuffer undoBuffer)
|
||||||
{
|
{
|
||||||
if (Mesh == null)
|
if (Mesh == null)
|
||||||
|
|
@ -161,23 +156,28 @@ namespace MatterHackers.MatterControl.DesignTools
|
||||||
var vertexSource = this.VertexSource;
|
var vertexSource = this.VertexSource;
|
||||||
var bounds = vertexSource.GetBounds();
|
var bounds = vertexSource.GetBounds();
|
||||||
vertexSource = vertexSource.Translate(-bounds.Left - AxisPosition, 0);
|
vertexSource = vertexSource.Translate(-bounds.Left - AxisPosition, 0);
|
||||||
|
Mesh mesh = null;
|
||||||
if (!Advanced)
|
if (!Advanced)
|
||||||
{
|
{
|
||||||
Mesh = VertexSourceToMesh.Revolve(vertexSource, Sides);
|
mesh = VertexSourceToMesh.Revolve(vertexSource, Sides);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Mesh = VertexSourceToMesh.Revolve(vertexSource,
|
mesh = VertexSourceToMesh.Revolve(vertexSource,
|
||||||
Sides,
|
Sides,
|
||||||
MathHelper.DegreesToRadians(StartingAngle),
|
MathHelper.DegreesToRadians(StartingAngle),
|
||||||
MathHelper.DegreesToRadians(EndingAngle));
|
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();
|
rebuildLock.Dispose();
|
||||||
Parent?.Invalidate(new InvalidateArgs(this, InvalidateType.Mesh));
|
Parent?.Invalidate(new InvalidateArgs(this, InvalidateType.Mesh));
|
||||||
return Task.CompletedTask;
|
return Task.CompletedTask;
|
||||||
|
|
|
||||||
|
|
@ -1 +1 @@
|
||||||
Subproject commit 3cd5c87f009f30e0fb867e9107a7eef31c2b9ad5
|
Subproject commit 49170baf0c5621c7b41099337c7c3328c94d2b62
|
||||||
Loading…
Add table
Add a link
Reference in a new issue