diff --git a/MatterControlLib/DesignTools/Operations/CurveObject3D_2.cs b/MatterControlLib/DesignTools/Operations/CurveObject3D_2.cs index 5f6034ccb..b731cfea7 100644 --- a/MatterControlLib/DesignTools/Operations/CurveObject3D_2.cs +++ b/MatterControlLib/DesignTools/Operations/CurveObject3D_2.cs @@ -106,7 +106,8 @@ namespace MatterHackers.MatterControl.DesignTools var currentMatrixInv = Matrix.Inverted; var aabb = this.GetAxisAlignedBoundingBox(currentMatrixInv); - layer.World.RenderCylinderOutline(this.WorldMatrix(), Vector3.Zero, Diameter, aabb.ZSize, 30, Color.Red); + layer.World.RenderCylinderOutline(this.WorldMatrix(), Vector3.Zero, Diameter, aabb.ZSize, 150, Color.Red, Color.Transparent); + layer.World.RenderCylinderOutline(this.WorldMatrix(), Vector3.Zero, Diameter, aabb.ZSize, (int)Math.Max(0, this.MinSidesPerRotation), Color.Transparent, Color.Red); } // turn the lighting back on diff --git a/MatterControlLib/PartPreviewWindow/View3D/WorldViewExtensions.cs b/MatterControlLib/PartPreviewWindow/View3D/WorldViewExtensions.cs index acf8ca938..2e9328e84 100644 --- a/MatterControlLib/PartPreviewWindow/View3D/WorldViewExtensions.cs +++ b/MatterControlLib/PartPreviewWindow/View3D/WorldViewExtensions.cs @@ -38,29 +38,41 @@ namespace MatterHackers.MeshVisualizer { public static class WorldViewExtensions { - public static void RenderCylinderOutline(this WorldView world, Matrix4X4 worldMatrix, Vector3 center, double Diameter, double Height, int sides, Color color, double lineWidth = 1, double extendLineLength = 0) + public static void RenderCylinderOutline(this WorldView world, Matrix4X4 worldMatrix, Vector3 center, double diameter, double height, int sides, Color color, double lineWidth = 1, double extendLineLength = 0) + { + world.RenderCylinderOutline(worldMatrix, center, diameter, height, sides, color, color, lineWidth, extendLineLength); + } + + public static void RenderCylinderOutline(this WorldView world, Matrix4X4 worldMatrix, Vector3 center, double diameter, double height, int sides, Color color1, Color color2, double lineWidth = 1, double extendLineLength = 0) { GLHelper.PrepareFor3DLineRender(true); Frustum frustum = world.GetClippingFrustum(); for (int i = 0; i < sides; i++) { - var rotatedPoint = new Vector3(Math.Cos(MathHelper.Tau * i / sides), Math.Sin(MathHelper.Tau * i / sides), 0) * Diameter / 2; - var sideTop = Vector3Ex.Transform(center + rotatedPoint + new Vector3(0, 0, Height / 2), worldMatrix); - var sideBottom = Vector3Ex.Transform(center + rotatedPoint + new Vector3(0, 0, -Height / 2), worldMatrix); - var rotated2Point = new Vector3(Math.Cos(MathHelper.Tau * (i + 1) / sides), Math.Sin(MathHelper.Tau * (i + 1) / sides), 0) * Diameter / 2; + var rotatedPoint = new Vector3(Math.Cos(MathHelper.Tau * i / sides), Math.Sin(MathHelper.Tau * i / sides), 0) * diameter / 2; + var sideTop = Vector3Ex.Transform(center + rotatedPoint + new Vector3(0, 0, height / 2), worldMatrix); + var sideBottom = Vector3Ex.Transform(center + rotatedPoint + new Vector3(0, 0, -height / 2), worldMatrix); + var rotated2Point = new Vector3(Math.Cos(MathHelper.Tau * (i + 1) / sides), Math.Sin(MathHelper.Tau * (i + 1) / sides), 0) * diameter / 2; var topStart = sideTop; - var topEnd = Vector3Ex.Transform(center + rotated2Point + new Vector3(0, 0, Height / 2), worldMatrix); + var topEnd = Vector3Ex.Transform(center + rotated2Point + new Vector3(0, 0, height / 2), worldMatrix); var bottomStart = sideBottom; - var bottomEnd = Vector3Ex.Transform(center + rotated2Point + new Vector3(0, 0, -Height / 2), worldMatrix); + var bottomEnd = Vector3Ex.Transform(center + rotated2Point + new Vector3(0, 0, -height / 2), worldMatrix); if (extendLineLength > 0) { GLHelper.ExtendLineEnds(ref sideTop, ref sideBottom, extendLineLength); } - world.Render3DLineNoPrep(frustum, sideTop, sideBottom, color, lineWidth); - world.Render3DLineNoPrep(frustum, topStart, topEnd, color, lineWidth); - world.Render3DLineNoPrep(frustum, bottomStart, bottomEnd, color, lineWidth); + if (color2 != Color.Transparent) + { + world.Render3DLineNoPrep(frustum, sideTop, sideBottom, color2, lineWidth); + } + + if (color1 != Color.Transparent) + { + world.Render3DLineNoPrep(frustum, topStart, topEnd, color1, lineWidth); + world.Render3DLineNoPrep(frustum, bottomStart, bottomEnd, color1, lineWidth); + } } // turn the lighting back on diff --git a/Submodules/agg-sharp b/Submodules/agg-sharp index cb36ab0c6..b38975217 160000 --- a/Submodules/agg-sharp +++ b/Submodules/agg-sharp @@ -1 +1 @@ -Subproject commit cb36ab0c6e7eb3ab7742d6a0ff1bbaad8df96f6a +Subproject commit b38975217af46de70d44e15f671c49534873a245