Orthographic projection mode with dynamic near/far.

This commit is contained in:
fortsnek9348 2022-03-02 00:52:04 +00:00
parent 0834aff9f4
commit e7947a2fd2
70 changed files with 2548 additions and 244 deletions

View file

@ -244,6 +244,40 @@ namespace MatterHackers.MatterControl.DesignTools.Operations
}
}
public static AxisAlignedBoundingBox GetWorldspaceAabbOfDrawPath(this IObject3D item)
{
AxisAlignedBoundingBox box = AxisAlignedBoundingBox.Empty();
if (item is IPathObject pathObject)
{
if (pathObject.VertexSource == null)
{
return box;
}
var lastPosition = Vector2.Zero;
var maxXYZ = item.GetAxisAlignedBoundingBox().MaxXYZ;
maxXYZ = maxXYZ.Transform(item.Matrix.Inverted);
foreach (var vertex in pathObject.VertexSource.Vertices())
{
var position = vertex.position;
if (vertex.IsLineTo)
{
box.ExpandToInclude(new Vector3(lastPosition, maxXYZ.Z + 0.002));
box.ExpandToInclude(new Vector3(position, maxXYZ.Z + 0.002));
}
lastPosition = position;
}
return box.NewTransformed(item.WorldMatrix());
}
return box;
}
public static bool IsRoot(this IObject3D object3D)
{
return object3D.Parent == null;