simple mesh
This commit is contained in:
parent
d095171a01
commit
e1ce3419f2
55 changed files with 713 additions and 698 deletions
|
|
@ -71,8 +71,8 @@ namespace MatterHackers.GCodeVisualizer
|
|||
for (int i = 0; i < steps; i++)
|
||||
{
|
||||
// create tube ends verts
|
||||
Vector3 tubeNormal = Vector3.Transform(startSweepDirection, Matrix4X4.CreateRotation(direction, MathHelper.Tau / (steps * 2) + MathHelper.Tau / (steps) * i));
|
||||
Vector3 offset = Vector3.Transform(startSweepDirection * radius, Matrix4X4.CreateRotation(direction, MathHelper.Tau / (steps * 2) + MathHelper.Tau / (steps) * i));
|
||||
Vector3 tubeNormal = Vector3Ex.Transform(startSweepDirection, Matrix4X4.CreateRotation(direction, MathHelper.Tau / (steps * 2) + MathHelper.Tau / (steps) * i));
|
||||
Vector3 offset = Vector3Ex.Transform(startSweepDirection * radius, Matrix4X4.CreateRotation(direction, MathHelper.Tau / (steps * 2) + MathHelper.Tau / (steps) * i));
|
||||
offset *= scale;
|
||||
|
||||
Vector3 tubeStart = startPos + offset;
|
||||
|
|
@ -84,9 +84,9 @@ namespace MatterHackers.GCodeVisualizer
|
|||
colorVertexData.Add(new ColorVertexData(tubeEnd, tubeNormal, color));
|
||||
|
||||
// create cap verts
|
||||
Vector3 rotateAngle = Vector3.Cross(startSweepDirection, direction);
|
||||
Vector3 capStartNormal = Vector3.Transform(startSweepDirection, Matrix4X4.CreateRotation(rotateAngle, MathHelper.Tau / 8));
|
||||
capStartNormal = Vector3.Transform(capStartNormal, Matrix4X4.CreateRotation(direction, MathHelper.Tau / (steps * 2) + MathHelper.Tau / (steps) * i));
|
||||
Vector3 rotateAngle = Vector3Ex.Cross(startSweepDirection, direction);
|
||||
Vector3 capStartNormal = Vector3Ex.Transform(startSweepDirection, Matrix4X4.CreateRotation(rotateAngle, MathHelper.Tau / 8));
|
||||
capStartNormal = Vector3Ex.Transform(capStartNormal, Matrix4X4.CreateRotation(direction, MathHelper.Tau / (steps * 2) + MathHelper.Tau / (steps) * i));
|
||||
capStartNormal = (capStartNormal * scale).GetNormal();
|
||||
Vector3 capStartOffset = capStartNormal * radius;
|
||||
capStartOffset *= scale;
|
||||
|
|
@ -94,8 +94,8 @@ namespace MatterHackers.GCodeVisualizer
|
|||
capStartIndices[i] = colorVertexData.Count;
|
||||
colorVertexData.Add(new ColorVertexData(capStart, capStartNormal, color));
|
||||
|
||||
Vector3 capEndNormal = Vector3.Transform(startSweepDirection, Matrix4X4.CreateRotation(-rotateAngle, MathHelper.Tau / 8));
|
||||
capEndNormal = Vector3.Transform(capEndNormal, Matrix4X4.CreateRotation(direction, MathHelper.Tau / (steps * 2) + MathHelper.Tau / (steps) * i));
|
||||
Vector3 capEndNormal = Vector3Ex.Transform(startSweepDirection, Matrix4X4.CreateRotation(-rotateAngle, MathHelper.Tau / 8));
|
||||
capEndNormal = Vector3Ex.Transform(capEndNormal, Matrix4X4.CreateRotation(direction, MathHelper.Tau / (steps * 2) + MathHelper.Tau / (steps) * i));
|
||||
capEndNormal = (capEndNormal * scale).GetNormal();
|
||||
Vector3 capEndOffset = capEndNormal * radius;
|
||||
capEndOffset *= scale;
|
||||
|
|
@ -163,8 +163,8 @@ namespace MatterHackers.GCodeVisualizer
|
|||
for (int i = 0; i < steps; i++)
|
||||
{
|
||||
// create tube ends verts
|
||||
Vector3 tubeNormal = Vector3.Transform(startSweepDirection, Matrix4X4.CreateRotation(direction, MathHelper.Tau / (steps * 2) + MathHelper.Tau / (steps) * i));
|
||||
Vector3 offset = Vector3.Transform(startSweepDirection * radius, Matrix4X4.CreateRotation(direction, MathHelper.Tau / (steps * 2) + MathHelper.Tau / (steps) * i));
|
||||
Vector3 tubeNormal = Vector3Ex.Transform(startSweepDirection, Matrix4X4.CreateRotation(direction, MathHelper.Tau / (steps * 2) + MathHelper.Tau / (steps) * i));
|
||||
Vector3 offset = Vector3Ex.Transform(startSweepDirection * radius, Matrix4X4.CreateRotation(direction, MathHelper.Tau / (steps * 2) + MathHelper.Tau / (steps) * i));
|
||||
Vector3 tubeStart = startPos + offset;
|
||||
tubeStartIndices[i] = colorVertexData.Count;
|
||||
colorVertexData.Add(new ColorVertexData(tubeStart, tubeNormal, color));
|
||||
|
|
|
|||
|
|
@ -143,10 +143,10 @@ namespace MatterHackers.GCodeVisualizer
|
|||
{
|
||||
Vector3Float startF = this.GetStart(renderInfo);
|
||||
Vector3Float endF = this.GetEnd(renderInfo);
|
||||
Vector2 start = new Vector2(startF.x, startF.y);
|
||||
Vector2 start = new Vector2(startF.X, startF.Y);
|
||||
renderInfo.Transform.transform(ref start);
|
||||
|
||||
Vector2 end = new Vector2(endF.x, endF.y);
|
||||
Vector2 end = new Vector2(endF.X, endF.Y);
|
||||
renderInfo.Transform.transform(ref end);
|
||||
|
||||
graphics2DGl.DrawAALineRounded(start, end, extrusionLineWidths / 2, extrusionColor);
|
||||
|
|
@ -163,8 +163,8 @@ namespace MatterHackers.GCodeVisualizer
|
|||
Vector3Float start = this.GetStart(renderInfo);
|
||||
Vector3Float end = this.GetEnd(renderInfo);
|
||||
|
||||
pathStorage.Add(start.x, start.y, ShapePath.FlagsAndCommand.MoveTo);
|
||||
pathStorage.Add(end.x, end.y, ShapePath.FlagsAndCommand.LineTo);
|
||||
pathStorage.Add(start.X, start.Y, ShapePath.FlagsAndCommand.MoveTo);
|
||||
pathStorage.Add(end.X, end.Y, ShapePath.FlagsAndCommand.LineTo);
|
||||
|
||||
graphics2D.Render(stroke, extrusionColor);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -100,7 +100,7 @@ namespace MatterHackers.GCodeVisualizer
|
|||
if ((renderInfo.CurrentRenderType & RenderType.Retractions) == RenderType.Retractions)
|
||||
{
|
||||
double radius = Radius(renderInfo.LayerScale);
|
||||
Vector2 position = new Vector2(this.position.x, this.position.y);
|
||||
Vector2 position = new Vector2(this.position.X, this.position.Y);
|
||||
|
||||
renderInfo.Transform.transform(ref position);
|
||||
|
||||
|
|
|
|||
|
|
@ -82,10 +82,10 @@ namespace MatterHackers.GCodeVisualizer
|
|||
{
|
||||
Vector3Float startF = this.GetStart(renderInfo);
|
||||
Vector3Float endF = this.GetEnd(renderInfo);
|
||||
Vector2 start = new Vector2(startF.x, startF.y);
|
||||
Vector2 start = new Vector2(startF.X, startF.Y);
|
||||
renderInfo.Transform.transform(ref start);
|
||||
|
||||
Vector2 end = new Vector2(endF.x, endF.y);
|
||||
Vector2 end = new Vector2(endF.X, endF.Y);
|
||||
renderInfo.Transform.transform(ref end);
|
||||
|
||||
if (renderInfo.CurrentRenderType.HasFlag(RenderType.TransparentExtrusion))
|
||||
|
|
@ -107,14 +107,14 @@ namespace MatterHackers.GCodeVisualizer
|
|||
Vector3Float start = this.GetStart(renderInfo);
|
||||
Vector3Float end = this.GetEnd(renderInfo);
|
||||
|
||||
pathStorage.Add(start.x, start.y, ShapePath.FlagsAndCommand.MoveTo);
|
||||
if (end.x != start.x || end.y != start.y)
|
||||
pathStorage.Add(start.X, start.Y, ShapePath.FlagsAndCommand.MoveTo);
|
||||
if (end.X != start.X || end.Y != start.Y)
|
||||
{
|
||||
pathStorage.Add(end.x, end.y, ShapePath.FlagsAndCommand.LineTo);
|
||||
pathStorage.Add(end.X, end.Y, ShapePath.FlagsAndCommand.LineTo);
|
||||
}
|
||||
else
|
||||
{
|
||||
pathStorage.Add(end.x + .01, end.y, ShapePath.FlagsAndCommand.LineTo);
|
||||
pathStorage.Add(end.X + .01, end.Y, ShapePath.FlagsAndCommand.LineTo);
|
||||
}
|
||||
|
||||
graphics2D.Render(stroke, movementColor);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue