What's the best algorithm to find the difference in two three dimensional shapes loaded in devDept Eyeshot?
I have loaded the two shapes from CAD files in Eyeshot and want to highlight the difference in the shapes.
Thanks in advance.
What's the best algorithm to find the difference in two three dimensional shapes loaded in devDept Eyeshot?
I have loaded the two shapes from CAD files in Eyeshot and want to highlight the difference in the shapes.
Thanks in advance.
So, here is a quick way of doing it. (At least what I think you're asking for) This function will take meshA and subtract any overlapping volume of meshB out of it. It returns a List of Meshes, as it is possible to "chop" meshA into multiple pieces by subtracting a single volume. I think the difference function will organize pieces by volume into the list, but I am NOT 100% on that.
public List<Mesh> solidSubtract(ref Mesh meshA, ref Mesh meshB)
{
List<Mesh> subtractedMeshes = new List<Mesh>();
Solid solidA = meshA.ConvertToSolid();
Solid solidB = meshB.ConvertToSolid();
Solid[] difference = Solid.Difference(solidA, solidB);
foreach (Solid sld in difference)
{
subtractedMeshes.Add(sld.ConvertToMesh());
}
return subtractedMeshes;
}