Click or drag to resize
AB4D logo

MeshBooleanOperations Class

MeshBooleanOperations static class defines methods that can execute subtract, intersect or union operations on 3D models.
Inheritance Hierarchy
SystemObject
  Ab3d.UtilitiesMeshBooleanOperations

Namespace:  Ab3d.Utilities
Assembly:  Ab3d.PowerToys (in Ab3d.PowerToys.dll) Version: 10.0.8000.1045
Syntax
C#
public static class MeshBooleanOperations

The MeshBooleanOperations type exposes the following members.

Methods
  NameDescription
Public methodStatic memberIntersect
Returns a new MeshGeometry3D that is created by intersecting mesh1 and mesh2 (space defined by both mesh1 and mesh2).
Public methodStatic memberSubtract(MeshGeometry3D, MeshGeometry3D, Boolean)
Returns a new MeshGeometry3D that is created by subtracting mesh2 from mesh1 (space defined by mesh1 but not inside mesh2).
Public methodStatic memberSubtract(GeometryModel3D, MeshGeometry3D, Transform3D, 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.
Public methodStatic memberSubtract(Model3D, MeshGeometry3D, Transform3D, Boolean)
Subtracts the specified meshGeometry3D from the specified model3D.
Public methodStatic memberSubtract(ModelVisual3D, MeshGeometry3D, Transform3D, Boolean)
Subtracts the specified meshGeometry3D from the specified modelVisual3D.
Public methodStatic memberUnion
Returns a new MeshGeometry3D that is created by merging mesh1 and mesh2 (space defined by either mesh1 or mesh2).
Top
Fields
  NameDescription
Public fieldStatic memberUsePolygonIndices
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.
Top
Remarks

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), 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.

See Also