Fixing issue with union on back to back faces
This commit is contained in:
parent
a8ce34c729
commit
2f3888137c
3 changed files with 69 additions and 4 deletions
|
|
@ -142,7 +142,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow.View3D
|
|||
}
|
||||
else
|
||||
{
|
||||
resultsMesh = Object3D.CombineParticipanets(SourceContainer, participants, cancellationToken, reporter);
|
||||
resultsMesh = Object3D.CombineParticipants(SourceContainer, participants, cancellationToken, reporter);
|
||||
}
|
||||
|
||||
var resultsItem = new Object3D()
|
||||
|
|
@ -152,7 +152,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow.View3D
|
|||
|
||||
if (holes != null)
|
||||
{
|
||||
var holesMesh = CombineParticipanets(SourceContainer, holes, cancellationToken, null);
|
||||
var holesMesh = CombineParticipants(SourceContainer, holes, cancellationToken, null);
|
||||
if (holesMesh != null)
|
||||
{
|
||||
var holesItem = new Object3D()
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
Subproject commit 8f4e9b969638d3c70ba81ac4f1a2d8faeda8c73b
|
||||
Subproject commit 8b8b6938b05a8780f079d2f2b6f9a69d621e090e
|
||||
|
|
@ -36,9 +36,11 @@ using MatterHackers.MatterControl.DesignTools;
|
|||
using MatterHackers.MatterControl.DesignTools.Operations;
|
||||
using MatterHackers.MatterControl.PartPreviewWindow.View3D;
|
||||
using MatterHackers.MatterControl.Tests.Automation;
|
||||
using MatterHackers.PolygonMesh;
|
||||
using MatterHackers.VectorMath;
|
||||
using NUnit.Framework;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace MatterControl.Tests.MatterControl
|
||||
|
|
@ -280,6 +282,8 @@ namespace MatterControl.Tests.MatterControl
|
|||
[Test, Category("InteractiveScene")]
|
||||
public async Task SubtractTests()
|
||||
{
|
||||
StartupMC();
|
||||
|
||||
// Subtract has correct number of results
|
||||
{
|
||||
var root = new Object3D();
|
||||
|
|
@ -287,7 +291,7 @@ namespace MatterControl.Tests.MatterControl
|
|||
var cubeB = await CubeObject3D.Create(20, 20, 20);
|
||||
var offsetCubeB = new TranslateObject3D(cubeB, 10);
|
||||
|
||||
var subtract = new SubtractObject3D();
|
||||
var subtract = new SubtractObject3D_2();
|
||||
subtract.Children.Add(cubeA);
|
||||
subtract.Children.Add(offsetCubeB);
|
||||
subtract.SelectedChildren.Add(offsetCubeB.ID);
|
||||
|
|
@ -564,6 +568,67 @@ namespace MatterControl.Tests.MatterControl
|
|||
Assert.IsTrue(rootAabb.Equals(new AxisAlignedBoundingBox(new Vector3(-10, -10, -10), new Vector3(10, 10, 11)), .01));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void CombineTests2()
|
||||
{
|
||||
// overlaping results in simple new mesh
|
||||
{
|
||||
var meshA = PlatonicSolids.CreateCube(10, 10, 10);
|
||||
meshA.Translate(0, 0, 0);
|
||||
var meshB = PlatonicSolids.CreateCube(10, 10, 10);
|
||||
meshB.Translate(0, 5, 0);
|
||||
var mesh = Object3D.CombineParticipants(null,
|
||||
new IObject3D[]
|
||||
{
|
||||
new Object3D() { Mesh = meshA },
|
||||
new Object3D() { Mesh = meshB },
|
||||
},
|
||||
new CancellationToken());
|
||||
Assert.AreEqual(12, mesh.Faces.Count());
|
||||
var aabb = mesh.GetAxisAlignedBoundingBox();
|
||||
Assert.AreEqual(15, aabb.YSize, .001);
|
||||
}
|
||||
|
||||
// multiple overlaping faces all combine
|
||||
{
|
||||
var meshA = PlatonicSolids.CreateCube(10, 10, 10);
|
||||
meshA.Translate(0, 0, 0);
|
||||
var meshB = PlatonicSolids.CreateCube(10, 10, 10);
|
||||
meshB.Translate(0, -3, 0);
|
||||
var meshC = PlatonicSolids.CreateCube(10, 10, 10);
|
||||
meshC.Translate(0, 3, 0);
|
||||
var mesh = Object3D.CombineParticipants(null,
|
||||
new IObject3D[]
|
||||
{
|
||||
new Object3D() { Mesh = meshA },
|
||||
new Object3D() { Mesh = meshB },
|
||||
new Object3D() { Mesh = meshC },
|
||||
},
|
||||
new CancellationToken());
|
||||
Assert.AreEqual(12, mesh.Faces.Count());
|
||||
var aabb = mesh.GetAxisAlignedBoundingBox();
|
||||
Assert.AreEqual(16, aabb.YSize, .001);
|
||||
}
|
||||
|
||||
// a back face against a front face, both are removed
|
||||
{
|
||||
var meshA = PlatonicSolids.CreateCube(10, 10, 10);
|
||||
meshA.Translate(0, -5, 0);
|
||||
var meshB = PlatonicSolids.CreateCube(10, 10, 10);
|
||||
meshB.Translate(0, 5, 0);
|
||||
var mesh = Object3D.CombineParticipants(null,
|
||||
new IObject3D[]
|
||||
{
|
||||
new Object3D() { Mesh = meshA },
|
||||
new Object3D() { Mesh = meshB },
|
||||
},
|
||||
new CancellationToken());
|
||||
Assert.AreEqual(12, mesh.Faces.Count());
|
||||
var aabb = mesh.GetAxisAlignedBoundingBox();
|
||||
Assert.AreEqual(15, aabb.YSize, .001);
|
||||
}
|
||||
}
|
||||
|
||||
[Test, Category("InteractiveScene")]
|
||||
public async Task AlignObjectHasCorrectPositionsOnXAxis()
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue