public class SoCSGShape extends SoShape
leftOperand
and rightOperand
. Constructive solid geometry allows the application to create a (potentially) complex object by using Boolean operators to combine (relatively) simple objects.
The left and right operands can be any scene graph, including other SoCSGShape
nodes. You can define a complex CSG geometry by creating a tree using multiple SoCSGShape
nodes. The specified scene graph's shapes must be closed (no holes) and CCW-orientated (all triangles composing shapes must be counter-clockwise).
Each time an operand is modified, a CSG Operation is performed. Keep this in mind if you create a CSGTree (SoCSGShape
which contains other SoCSGShapes), especially if you use associative and commutative operations (only additions or only intersections) because the result of such operations does not depend on the tree ( (A + B) + C = A + (B + C) ). In this case, try to build your tree by putting the most often modified nodes at the top of the tree.
For example, a tree optimized for modification on first node ( N1 ) will look like this:
S __|__S | __|__S N1 | __|__S N2 | __|__ N3 | | N4 N5
Where S are SoCSGShape
and N1, N2, ... are ordinary nodes. In this case, a modification on N1 will need only 1 csgOperation, whereas a modificaion on N5 will need 4 csgOperations to regenerate the resulting shape.
A tree optimized for random modification will try to minimize its depth:
S ________|_________ | | ____S____ ____S____ | | | | __S__ N3 N4 N5 | | N1 N2
In this case, any modification will require at most 3 CSG Operations.
CSGShape {
leftOperand | NULL |
rightOperand | NULL |
csgOperation | ADD |
LIMITATIONS Only vertices are handled in the generated shape. None of the normal, color, or texCoord properties of the left or right operands are taken into account. Shaders are also not taken in account, even vertex shaders. But note that you can use a shader above SoCSGShape
. The shader will be applied to the result of the CSG operation.
See also:
Modifier and Type | Class and Description |
---|---|
static class |
SoCSGShape.CsgOperationTypes
CSG operation to be used.
|
static class |
SoCSGShape.CsgStatus
Status of CSG operation.
|
SoShape.ShapeTypes
Inventor.ConstructorCommand
Modifier and Type | Field and Description |
---|---|
static int |
ADD
Deprecated.
Use
SoCSGShape.CsgOperationTypes.ADD instead. |
static int |
ALL
Deprecated.
Use
SoCSGShape.CsgOperationTypes.ALL instead. |
static int |
CSG_ERROR
Deprecated.
Use
SoCSGShape.CsgStatus.CSG_ERROR instead. |
static int |
CSG_LIB_NOT_AVAILABLE
Deprecated.
Use
SoCSGShape.CsgStatus.CSG_LIB_NOT_AVAILABLE instead. |
static int |
CSG_NO_ERROR
Deprecated.
Use
SoCSGShape.CsgStatus.CSG_NO_ERROR instead. |
SoSFEnum<SoCSGShape.CsgOperationTypes> |
csgOperation
CSG boolean operation to apply.
|
static int |
INTERSECTION
Deprecated.
Use
SoCSGShape.CsgOperationTypes.INTERSECTION instead. |
static int |
LEFT_ONLY
Deprecated.
Use
SoCSGShape.CsgOperationTypes.LEFT_ONLY instead. |
SoSFNode |
leftOperand
Geometry scene graph to be used as left operand for the Boolean operation.
|
static int |
NOTHING
Deprecated.
Use
SoCSGShape.CsgOperationTypes.NOTHING instead. |
static int |
RIGHT_ONLY
Deprecated.
Use
SoCSGShape.CsgOperationTypes.RIGHT_ONLY instead. |
SoSFNode |
rightOperand
Geometry scene graph to be used as right operand for the Boolean operation.
|
static int |
SUB
Deprecated.
Use
SoCSGShape.CsgOperationTypes.SUB instead. |
boundingBoxIgnoring, LINES, POINTS, POLYGONS, TEXT
VERBOSE_LEVEL, ZeroHandle
Constructor and Description |
---|
SoCSGShape()
Constructor.
|
Modifier and Type | Method and Description |
---|---|
SoCSGShape.CsgStatus |
getStatus()
Returns status of csg operation.
|
void |
setMaxAttempt(int maxAttempt)
If the CSG Operation failed for any reason, it will be retried by applying a small random transformation to the operand vertices.
|
static void |
setRescueOperation(SoCSGShape.CsgOperationTypes op)
Set operation to use if the CSG operation fails or CSGLib is not available.
|
getShapeType, isPrimitiveRestartAvailable, isPrimitiveRestartAvailable
affectsState, callback, copy, copy, distribute, doAction, getAlternateRep, getBoundingBox, getByName, getMatrix, getPrimitiveCount, getRenderUnitID, GLRender, GLRenderBelowPath, GLRenderInPath, GLRenderOffPath, grabEventsCleanup, grabEventsSetup, handleEvent, isBoundingBoxIgnoring, isOverride, pick, rayPick, search, setOverride, touch, write
copyFieldValues, copyFieldValues, enableNotify, fieldsAreEqual, get, getAllFields, getEventIn, getEventOut, getField, getFieldName, hasDefaultValues, isNotifyEnabled, set, setToDefaults
dispose, getEXTERNPROTO, getName, getPROTO, isDisposable, isSynchronizable, setName, setSynchronizable
getAddress, getNativeResourceHandle, startInternalThreads, stopInternalThreads
@Deprecated public static final int ADD
SoCSGShape.CsgOperationTypes.ADD
instead.@Deprecated public static final int SUB
SoCSGShape.CsgOperationTypes.SUB
instead.@Deprecated public static final int INTERSECTION
SoCSGShape.CsgOperationTypes.INTERSECTION
instead.@Deprecated public static final int LEFT_ONLY
SoCSGShape.CsgOperationTypes.LEFT_ONLY
instead.@Deprecated public static final int RIGHT_ONLY
SoCSGShape.CsgOperationTypes.RIGHT_ONLY
instead.@Deprecated public static final int NOTHING
SoCSGShape.CsgOperationTypes.NOTHING
instead.@Deprecated public static final int ALL
SoCSGShape.CsgOperationTypes.ALL
instead.@Deprecated public static final int CSG_NO_ERROR
SoCSGShape.CsgStatus.CSG_NO_ERROR
instead.@Deprecated public static final int CSG_LIB_NOT_AVAILABLE
SoCSGShape.CsgStatus.CSG_LIB_NOT_AVAILABLE
instead.@Deprecated public static final int CSG_ERROR
SoCSGShape.CsgStatus.CSG_ERROR
instead.public final SoSFNode leftOperand
public final SoSFNode rightOperand
public final SoSFEnum<SoCSGShape.CsgOperationTypes> csgOperation
public void setMaxAttempt(int maxAttempt)
SoCSGShape
will retry before giving up and using the rescueOperation (see setRescueOperation
). A max attempt of 5 is enough. If CSG Operation fails after 5 attempts, it will probably fail all the time.
Default is 5.
Warning A value > 0 may change the coordinates of geometries as they will be transformed a little bit to apply the CSG operation. This transformation is normally not visible to the naked eye (it's about 0.01%), but may cause issues if you need precise values.
public SoCSGShape.CsgStatus getStatus()
Note Status is updated only when the node is traversed. Initially returns CSG_NO_ERROR. .
public static void setRescueOperation(SoCSGShape.CsgOperationTypes op)
Generated on January 23, 2025, Copyright © Thermo Fisher Scientific. All rights reserved. http://www.openinventor.com