Mesh |
public static class MeshBooleanOperations
The MeshBooleanOperations type exposes the following members.
Name | Description | |
---|---|---|
Intersect | Returns a new MeshGeometry3D that is created by intersecting mesh1 and mesh2 (space defined by both mesh1 and mesh2). | |
Subtract(MeshGeometry3D, MeshGeometry3D, Boolean, Boolean) | Returns a new MeshGeometry3D that is created by subtracting mesh2 from mesh1 (space defined by mesh1 but not inside mesh2). | |
Subtract(GeometryModel3D, MeshGeometry3D, Transform3D, Boolean, Boolean) | Updates the MeshGeometry3D of the specified geometryModel3D with subtracting the specified meshGeometry3D from it. This method replaces the geometryModel3D.Geometry object with a new MeshGeometry3D object. The geometryModel3D.Geometry is transformed with geometryModel3D.Transform before being subtracted. | |
Subtract(Model3D, MeshGeometry3D, Transform3D, Boolean, Boolean) | Subtracts the specified meshGeometry3D from the specified model3D. | |
Subtract(ModelVisual3D, MeshGeometry3D, Transform3D, Boolean, Boolean) | Subtracts the specified meshGeometry3D from the specified modelVisual3D. | |
Union | Returns a new MeshGeometry3D that is created by merging mesh1 and mesh2 (space defined by either mesh1 or mesh2). |
Name | Description | |
---|---|---|
UsePolygonIndices | UsePolygonIndices is a static field that specifies if PolygonIndices from MeshGeometry3D are used to get initial polygons. When false (by default), then initial polygons are created from MeshGeometry3D.TriangleIndices (one polygon from one triangle). In some cases (box mesh) this can create a few more polygons, but in many cases (cylinder, sphere, etc.) this will create correct polygons because on meshes with curved surfaces polygons are not created from curved surfaces. See PolygonIndicesProperty for more info. |
MeshBooleanOperations static class defines methods that can execute subtract, intersect or union operations on 3D models.
MeshGeometry3D can be generated with Subtract(MeshGeometry3D, MeshGeometry3D, Boolean, Boolean), Union(MeshGeometry3D, MeshGeometry3D, Boolean) and Intersect(MeshGeometry3D, MeshGeometry3D, Boolean) methods. Subtract operations can be also done on Model3D or Visual3D objects.
The methods work only on MeshGeometry3D meshes and creates new MeshGeometry3D that have defined Positions and TriangleIndices.
The methods do not calculate TextureCoordinates. They can be calculated with using texture coordinates generators from MeshUtils class: GenerateCubicTextureCoordinates(MeshGeometry3D), GeneratePlanarTextureCoordinates(MeshGeometry3D, Vector3D, Vector3D, Boolean, Boolean, Boolean), GenerateCylindricalTextureCoordinates(MeshGeometry3D, Vector3D, Vector3D).
Normals are also not calculated, but can be generated with CalculateNormals(MeshGeometry3D) method.
All the methods take also the processOnlyIntersectingTriangles parameter. When it is true (by default) then only triangles from mesh1 that intersect the bounds of mesh2 will be processed by subtraction; other triangles will be copied from the mesh1. This can produce significantly simpler mesh.
The MeshBooleanOperations also defines a public static field UsePolygonIndices that can be set to true to use polygons from PolygonIndices.