Improving Plus operation to be more efficient when building dynamic content
Added a rebuild to ImageObject3D
This commit is contained in:
parent
a32451635c
commit
5786db9417
3 changed files with 38 additions and 12 deletions
|
|
@ -231,19 +231,37 @@ namespace MatterHackers.MatterControl.DesignTools.Operations
|
|||
return output;
|
||||
}
|
||||
|
||||
public static IObject3D Plus(this IObject3D a, IObject3D b)
|
||||
/// <summary>
|
||||
/// Union a and b together. This can either return a single item with a mesh on it
|
||||
/// or a group item that has the a and be itmes as children
|
||||
/// </summary>
|
||||
/// <param name="a"></param>
|
||||
/// <param name="b"></param>
|
||||
/// <param name="doMeshCombine"></param>
|
||||
/// <returns></returns>
|
||||
public static IObject3D Plus(this IObject3D a, IObject3D b, bool doMeshCombine = false)
|
||||
{
|
||||
var combine = new CombineObject3D_2();
|
||||
combine.Children.Add(a.Clone());
|
||||
combine.Children.Add(b.Clone());
|
||||
|
||||
combine.Combine();
|
||||
|
||||
var finalMesh = combine.VisibleMeshes().First().Mesh;
|
||||
return new Object3D()
|
||||
if (doMeshCombine)
|
||||
{
|
||||
Mesh = finalMesh
|
||||
};
|
||||
var combine = new CombineObject3D_2();
|
||||
combine.Children.Add(a.Clone());
|
||||
combine.Children.Add(b.Clone());
|
||||
|
||||
combine.Combine();
|
||||
|
||||
var finalMesh = combine.VisibleMeshes().First().Mesh;
|
||||
return new Object3D()
|
||||
{
|
||||
Mesh = finalMesh
|
||||
};
|
||||
}
|
||||
else
|
||||
{
|
||||
var group = new GroupObject3D();
|
||||
group.Children.Add(a);
|
||||
group.Children.Add(b);
|
||||
return group;
|
||||
}
|
||||
}
|
||||
|
||||
public static IObject3D Minus(this IObject3D a, IObject3D b)
|
||||
|
|
|
|||
|
|
@ -30,6 +30,7 @@ either expressed or implied, of the FreeBSD Project.
|
|||
using System;
|
||||
using System.IO;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using MatterHackers.Agg;
|
||||
using MatterHackers.Agg.Image;
|
||||
using MatterHackers.Agg.ImageProcessing;
|
||||
|
|
@ -172,6 +173,13 @@ namespace MatterHackers.MatterControl.DesignTools
|
|||
|
||||
public double ScaleMmPerPixels { get; private set; }
|
||||
|
||||
public override Task Rebuild()
|
||||
{
|
||||
InitMesh();
|
||||
|
||||
return base.Rebuild();
|
||||
}
|
||||
|
||||
private Mesh InitMesh()
|
||||
{
|
||||
if (!string.IsNullOrWhiteSpace(this.AssetPath))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue