I want to write plugin (library) for Unity3d (it doesn't matter which framework I will choose for this, question is ), for cutting arbitrary mesh with plane (for simplicity it will be plane for beginning).
There are following steps:
1) check every triangle whether it lies above, under plane or intersected by plane, assign all vertices to VER_ABOVE
or VER_UNDER
lists, recalculate triangles, put them in TRI_ABOVE
or TRI_UNDER
lists
2) Split intersected triangles into triangle and quadrilateral, triangulate last one and put them in corresponding lists (TRI_ABOVE
or TRI_UNDER
)
3) Triangulate slice surface, assign it to TRI_ABOVE
and TRI_UNDER
And now the question:
Where it is better to calculate intersections, triangulation (for example I will use Constrained Delaunay Triangulation or Sweep Line Non-Convex Polygonal Triangulation cutting into monotone polygonals) and other stuff: on CPU or on GPU (using Shaders), if someone could explain me general pipeline from loading cashing mesh to memory and so on on GPU and on CPU, so I can better understand the most time consuming actions and can optimize some stuff.
I will also be thankful for sharing link on code examples calculating similar stuff.