Click or drag to resize
Ab4d.SharpEngine logo

MeshBooleanOperationsSubtract(ModelNode, StandardMesh, Transform, Boolean, Boolean) Method

Returns a ModelNode that is created by subtracting mesh from modelNode (space defined by mesh but not inside modelNode). The mesh that is defined by modelNode is transformed by optional parentTransform and by ModelNode.Transform.

Namespace: Ab4d.SharpEngine.Utilities
Assembly: Ab4d.SharpEngine (in Ab4d.SharpEngine.dll) Version: 2.0.8956+4c7684e186ca1be74e7a284fbe739d9a1b843d3c
Syntax
C#
public static ModelNode? Subtract(
	ModelNode modelNode,
	StandardMesh mesh,
	Transform? parentTransform = null,
	bool processOnlyIntersectingTriangles = true,
	bool generateInnerTriangles = true
)

Parameters

modelNode  ModelNode
ModelNode that will be changed with subtracting the specified StandardMesh
mesh  StandardMesh
StandardMesh that will be used to subtract the ModelNode
parentTransform  Transform  (Optional)
optional Transform that will be applied to the positions (null by default)
processOnlyIntersectingTriangles  Boolean  (Optional)
when 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.
generateInnerTriangles  Boolean  (Optional)
when true (by default) then then triangles inside the first mesh are generated (this closes the hole that is created by subtraction); when false then no additional inner triangles are generated - only existing triangles are processed in subtraction

Return Value

ModelNode
Subtracted ModelNode
Remarks

Returns a new ModelNode that is created by subtracting mesh from modelNode (space defined by mesh but not inside modelNode). The mesh that is defined by modelNode is transformed by optional parentTransform and by ModelNode.Transform.

When the mesh does not intersect with the modelNode, then the original modelNode is returned. Otherwise a new MeshModelNode is created from the subtracted mesh.

Because boolean operations do not generate TextureCoordinates, it will not be possible to show textures after calling this method. To manually generate texture coordinates you can use the methods from MeshUtils class: GenerateCubicTextureCoordinates, GeneratePlanarTextureCoordinates or GenerateCylindricalTextureCoordinates in MeshUtils class.

See Also