Description
The MergeMesh
method is used to merge another PolygonMesh
into the current mesh. This operation applies a transformation to the source mesh and integrates its vertices, edges, and faces into the current mesh structure. The method also outputs mappings of the new vertices, half-edges, and faces created during the merge process.
Usage
To use the MergeMesh
method, you need to provide the source mesh you want to merge, a transformation to apply to the source mesh, and dictionaries to store the mappings of new vertices, half-edges, and faces. These dictionaries will be populated with the corresponding handles from the source mesh to the new handles in the current mesh.
Example
// Create a new PolygonMesh instance
PolygonMesh currentMesh = new PolygonMesh();
PolygonMesh sourceMesh = new PolygonMesh();
// Define a transformation
Transform transform = new Transform();
// Prepare dictionaries to hold the new mappings
var newVertices = new Dictionary<HalfEdgeMesh.VertexHandle, HalfEdgeMesh.VertexHandle>();
var newHalfEdges = new Dictionary<HalfEdgeMesh.HalfEdgeHandle, HalfEdgeMesh.HalfEdgeHandle>();
var newFaces = new Dictionary<HalfEdgeMesh.FaceHandle, HalfEdgeMesh.FaceHandle>();
// Merge the source mesh into the current mesh
currentMesh.MergeMesh(sourceMesh, transform, out newVertices, out newHalfEdges, out newFaces);
// The newVertices, newHalfEdges, and newFaces dictionaries now contain the mappings from the source mesh to the current mesh.