I am working on cutting meshes. What am I exactly trying to achieve is that:
Input - two meshes(procedurally generated of course)
Output - three meshes(or more, depends on the given meshes)
A - which is a meshA substract mesh B,
B - which is a common part of meshes A and B,
C - which is a mesh B substract mesh A.
I am using the Triangulator that for the given set of vertices creates triangles for me. All I have to do is to give him those vertices, and here goes the question. Is there any algorithm that would help me to do this? Maybe your brilliant idea that came into your mind at the time you saw this picture? I am working in Unity(C#) so anything related to Unity Tools is helpful aswell. Thanks !
EDIT:
I am using this clipping library: http://sourceforge.net/projects/polyclipping/ and everything works fine untill this case:
I am trying to get the difference A-B and it should look like the one from Picture 2), unfortunately the output is mesh A and mesh B as in the picture 1).
What i do:
Clipper c = new Clipper();
c.AddPath(here goes the vertices of mesh A, polyType.Subject, true);
c.AddPath(here goes the vertices of mesh B, polyType.Clip, true);
c.Execute(ClipType.ctDIfference, a list of lists for my output, PolyFillType.NonZero, PolyFillType.NonZero);
I've already tried to change PolyFillTypes but it changed nothing. And here I am, asking for your advices :)