fix parsing of bad bounds

This commit is contained in:
LarsBrubaker 2022-04-10 16:35:13 -07:00
parent 4336fff164
commit a216a484bb
3 changed files with 16 additions and 12 deletions

View file

@ -147,15 +147,6 @@ namespace MatterHackers.MatterControl.PartPreviewWindow.View3D
var totalOperations = touchingSets.Sum(t => t.Count); var totalOperations = touchingSets.Sum(t => t.Count);
#if false
var resultsMesh = BooleanProcessing.DoArray(items,
CsgModes.Union,
Processing,
InputResolution,
OutputResolution,
reporter,
cancellationToken);
#else
double amountPerOperation = 1.0 / totalOperations; double amountPerOperation = 1.0 / totalOperations;
double ratioCompleted = 0; double ratioCompleted = 0;
@ -169,6 +160,16 @@ namespace MatterHackers.MatterControl.PartPreviewWindow.View3D
if (set.Count > 1) if (set.Count > 1)
{ {
#if false
setMesh = BooleanProcessing.DoArray(set.Select(i => (i.mesh, i.matrix)),
CsgModes.Union,
Processing,
InputResolution,
OutputResolution,
reporter,
cancellationToken);
#else
bool first = true; bool first = true;
foreach (var next in set) foreach (var next in set)
{ {
@ -203,6 +204,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow.View3D
progressStatus.Progress0To1 = ratioCompleted; progressStatus.Progress0To1 = ratioCompleted;
reporter?.Report(progressStatus); reporter?.Report(progressStatus);
} }
#endif
setMeshes.Add(setMesh); setMeshes.Add(setMesh);
} }
@ -229,7 +231,6 @@ namespace MatterHackers.MatterControl.PartPreviewWindow.View3D
resultsMesh.CopyAllFaces(setMesh, Matrix4X4.Identity); resultsMesh.CopyAllFaces(setMesh, Matrix4X4.Identity);
} }
} }
#endif
if (resultsMesh != null) if (resultsMesh != null)
{ {

View file

@ -257,7 +257,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow.View3D
foreach (var keep in keepItems) foreach (var keep in keepItems)
{ {
#if false #if false
var items = removeVisibleItems.Select(i => (i.Mesh, i.WorldMatrix(SourceContainer))).ToList(); var items = removeItems.Select(i => (i.Mesh, i.WorldMatrix(SourceContainer))).ToList();
items.Insert(0, (keep.Mesh, keep.Matrix)); items.Insert(0, (keep.Mesh, keep.Matrix));
var resultsMesh = BooleanProcessing.DoArray(items, var resultsMesh = BooleanProcessing.DoArray(items,
CsgModes.Subtract, CsgModes.Subtract,

View file

@ -748,7 +748,10 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
Tuple<double, double> nearFar = null; Tuple<double, double> nearFar = null;
foreach (var aabb in Object3DControlLayer.MakeListOfObjectControlBoundingBoxes()) foreach (var aabb in Object3DControlLayer.MakeListOfObjectControlBoundingBoxes())
{ {
nearFar = ExpandNearAndFarToClippedBounds(nearFar, world.IsOrthographic, worldspacePlanes, world.ModelviewMatrix, aabb); if (!double.IsNaN(aabb.MinXYZ.X) && !double.IsInfinity(aabb.MinXYZ.X))
{
nearFar = ExpandNearAndFarToClippedBounds(nearFar, world.IsOrthographic, worldspacePlanes, world.ModelviewMatrix, aabb);
}
} }
nearFar = ExpandNearAndFarToClippedBounds(nearFar, world.IsOrthographic, worldspacePlanes, world.ModelviewMatrix, Object3DControlLayer.GetPrinterNozzleAABB()); nearFar = ExpandNearAndFarToClippedBounds(nearFar, world.IsOrthographic, worldspacePlanes, world.ModelviewMatrix, Object3DControlLayer.GetPrinterNozzleAABB());
nearFar = ExpandNearAndFarToClippedBounds(nearFar, world.IsOrthographic, worldspacePlanes, world.ModelviewMatrix, Scene.GetAxisAlignedBoundingBox()); nearFar = ExpandNearAndFarToClippedBounds(nearFar, world.IsOrthographic, worldspacePlanes, world.ModelviewMatrix, Scene.GetAxisAlignedBoundingBox());