Refactoring IBvhItem
This commit is contained in:
parent
fa7447688f
commit
f01f1604b9
6 changed files with 24 additions and 6 deletions
|
|
@ -42,6 +42,7 @@ using MatterHackers.Agg;
|
|||
using MatterHackers.DataConverters3D;
|
||||
using MatterHackers.MatterControl.DesignTools;
|
||||
using MatterHackers.PolygonMesh.Csg;
|
||||
using MatterHackers.RayTracer;
|
||||
using MatterHackers.VectorMath;
|
||||
|
||||
namespace MatterHackers.PolygonMesh
|
||||
|
|
@ -121,7 +122,11 @@ namespace MatterHackers.PolygonMesh
|
|||
}
|
||||
}
|
||||
|
||||
private static Mesh AsImplicitMeshes(IEnumerable<(Mesh mesh, Matrix4X4 matrix)> items, CsgModes operation, ProcessingModes processingMode, ProcessingResolution inputResolution, ProcessingResolution outputResolution)
|
||||
private static Mesh AsImplicitMeshes(IEnumerable<(Mesh mesh, Matrix4X4 matrix)> items,
|
||||
CsgModes operation,
|
||||
ProcessingModes processingMode,
|
||||
ProcessingResolution inputResolution,
|
||||
ProcessingResolution outputResolution)
|
||||
{
|
||||
Mesh implicitResult = null;
|
||||
|
||||
|
|
@ -255,11 +260,14 @@ namespace MatterHackers.PolygonMesh
|
|||
var progressStatus = new ProgressStatus();
|
||||
var totalOperations = 0;
|
||||
var transformedMeshes = new List<Mesh>();
|
||||
var bvhAccelerators = new List<ITraceable>();
|
||||
foreach (var (mesh, matrix) in meshAndMatrix)
|
||||
{
|
||||
totalOperations += mesh.Faces.Count;
|
||||
transformedMeshes.Add(mesh.Copy(CancellationToken.None));
|
||||
transformedMeshes.Last().Transform(matrix);
|
||||
var meshCopy = mesh.Copy(CancellationToken.None);
|
||||
transformedMeshes.Add(meshCopy);
|
||||
meshCopy.Transform(matrix);
|
||||
bvhAccelerators.Add(MeshToBVH.Convert(meshCopy));
|
||||
}
|
||||
|
||||
var plansByMesh = new List<List<Plane>>();
|
||||
|
|
@ -316,7 +324,7 @@ namespace MatterHackers.PolygonMesh
|
|||
|
||||
var mesh2 = transformedMeshes[sliceMeshIndex];
|
||||
// calculate and add the PWN face from the loops
|
||||
var slice = SliceLayer.CreateSlice(mesh2, cutPlane, transformTo0Plane);
|
||||
var slice = SliceLayer.CreateSlice(mesh2, cutPlane, transformTo0Plane, bvhAccelerators[sliceMeshIndex]);
|
||||
if (firstSlice)
|
||||
{
|
||||
totalSlice = slice;
|
||||
|
|
@ -465,7 +473,13 @@ namespace MatterHackers.PolygonMesh
|
|||
return resultsMesh;
|
||||
}
|
||||
|
||||
private static Mesh ExactLegacy(IEnumerable<(Mesh mesh, Matrix4X4 matrix)> items, CsgModes operation, ProcessingModes processingMode, ProcessingResolution inputResolution, ProcessingResolution outputResolution, IProgress<ProgressStatus> reporter, CancellationToken cancellationToken)
|
||||
private static Mesh ExactLegacy(IEnumerable<(Mesh mesh, Matrix4X4 matrix)> items,
|
||||
CsgModes operation,
|
||||
ProcessingModes processingMode,
|
||||
ProcessingResolution inputResolution,
|
||||
ProcessingResolution outputResolution,
|
||||
IProgress<ProgressStatus> reporter,
|
||||
CancellationToken cancellationToken)
|
||||
{
|
||||
var progressStatus = new ProgressStatus();
|
||||
var totalOperations = items.Count() - 1;
|
||||
|
|
|
|||
|
|
@ -32,6 +32,7 @@ using System.Collections.Generic;
|
|||
using System.Linq;
|
||||
using MatterHackers.Agg.UI;
|
||||
using MatterHackers.DataConverters3D;
|
||||
using MatterHackers.PolygonMesh.Processors;
|
||||
using MatterHackers.RayTracer;
|
||||
using MatterHackers.RayTracer.Traceable;
|
||||
using MatterHackers.VectorMath;
|
||||
|
|
|
|||
|
|
@ -29,6 +29,7 @@ either expressed or implied, of the FreeBSD Project.
|
|||
|
||||
using MatterHackers.Agg.UI;
|
||||
using MatterHackers.DataConverters3D;
|
||||
using MatterHackers.PolygonMesh.Processors;
|
||||
using MatterHackers.RayTracer;
|
||||
using MatterHackers.VectorMath;
|
||||
|
||||
|
|
|
|||
|
|
@ -44,6 +44,7 @@ using MatterHackers.MatterControl.SlicerConfiguration;
|
|||
using MatterHackers.MeshVisualizer;
|
||||
using MatterHackers.Plugins.EditorTools;
|
||||
using MatterHackers.PolygonMesh;
|
||||
using MatterHackers.PolygonMesh.Processors;
|
||||
using MatterHackers.RayTracer;
|
||||
using MatterHackers.RenderOpenGl;
|
||||
using MatterHackers.RenderOpenGl.OpenGl;
|
||||
|
|
|
|||
|
|
@ -52,6 +52,7 @@ using MatterHackers.MatterControl.Library;
|
|||
using MatterHackers.MatterControl.PrinterCommunication;
|
||||
using MatterHackers.MatterControl.PrinterControls.PrinterConnections;
|
||||
using MatterHackers.MatterControl.SlicerConfiguration;
|
||||
using MatterHackers.PolygonMesh.Processors;
|
||||
using MatterHackers.RayTracer;
|
||||
using MatterHackers.RenderOpenGl;
|
||||
using MatterHackers.RenderOpenGl.OpenGl;
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
Subproject commit beea93ece48c0ec46fbf0b037106aa3a9e3baf5a
|
||||
Subproject commit 5ede7a0c6ae538b73eddf77195805d239c497064
|
||||
Loading…
Add table
Add a link
Reference in a new issue