Click or drag to resize
PlaneGeometryIntersection Class

Class for computing the intersection of geometry with a plane.

Preview Feature: this class is fully supported and can be used in Open Inventor applications. Being tagged as a Preview Feature just means that the implementation is still subject to API changes and adjustments based on feedback from early adopters. Please be also aware that source compatibility might be broken regardless of the Open Inventor compatibility changes policy due to our commitment to bring needed changes to be sure the specifications of this Preview Feature match the expectations of our customers.

Inheritance Hierarchy

Namespace: OIV.Medical.Nodes
Assembly: OIV.Medical (in OIV.Medical.dll) Version: 2024.1.1.0.Release.cb64a23ffb514e400c7a72e2158dfc53ef4ceb26
Syntax
public class PlaneGeometryIntersection : SoSeparator

The PlaneGeometryIntersection type exposes the following members.

Constructors
  NameDescription
Public methodPlaneGeometryIntersection
Recompute the intersection. Recomputes the intersection boundary(s) based on the current #scene and #plane. Normally used when the #automatic field is set to false. Useful when the goal is simply to compute the intersection. Also useful if recomputation is too slow. For example, to defer recomputation until the user has finished moving the clip plane. Returns 0 if successful. Any other value means that an error occured during the computation and the geometry may not be valid.
Top
Methods
  NameDescription
Public methodAddChild

Adds a child as last one in group.

(Inherited from SoGroup.)
Public methodAffectsState

Returns true if a node has an effect on the state during traversal.

(Inherited from SoSeparator.)
Public methodCallback
(Inherited from SoSeparator.)
Public methodClearCacheList
(Inherited from SoSeparator.)
Public methodCopy
Calls Copy(false).
(Inherited from SoNode.)
Public methodCopy(Boolean)

Creates and returns an exact copy of the node.

(Inherited from SoNode.)
Public methodCopyFieldValues(SoFieldContainer)
Calls CopyFieldValues(fc, false).
(Inherited from SoFieldContainer.)
Public methodCopyFieldValues(SoFieldContainer, Boolean)

Copies the contents of fc's fields into this object's fields.

(Inherited from SoFieldContainer.)
Public methodDispose
Releases all resources used by SoDisposable.
(Inherited from SoDisposable.)
Public methodDistribute
(Inherited from SoNode.)
Public methodDoAction
(Inherited from SoSeparator.)
Public methodEnableNotify

Notification at this Field Container is enabled (if flag == true) or disabled (if flag == false).

(Inherited from SoFieldContainer.)
Public methodEquals
Determines whether the specified Object is equal to the current Object.
(Inherited from Object.)
Public methodFieldsAreEqual

Returns true if this object's fields are exactly equal to fc's fields.

(Inherited from SoFieldContainer.)
Public methodFindChild

Finds index of given child within group.

(Inherited from SoGroup.)
Public methodGet

Returns the values of the fields of this object in the Open Inventor ASCII file format in the given string.

(Inherited from SoFieldContainer.)
Public methodGetAllFields

Returns a list of fields, including the eventIn's and eventOut's.

(Inherited from SoFieldContainer.)
Public methodGetAlternateRep

This method is called by actions to allow the node to provide an "alternate representation" when appropriate (typically depending on the action type).

(Inherited from SoNode.)
Public methodGetBoundingBox
(Inherited from SoSeparator.)
Public methodGetChild

Returns pointer the child node with the given index.

(Inherited from SoGroup.)
Public methodGetEventIn

Returns a the eventIn with the given name.

(Inherited from SoFieldContainer.)
Public methodGetEventOut

Returns the eventOut with the given name.

(Inherited from SoFieldContainer.)
Public methodGetField

Returns a the field of this object whose name is fieldName.

(Inherited from SoFieldContainer.)
Public methodGetFieldName

Returns the name of the given field in the fieldName argument.

(Inherited from SoFieldContainer.)
Public methodGetFields

Appends references to all of this object's fields to resultList, and returns the number of fields appended.

(Inherited from SoFieldContainer.)
Public methodGetHashCode
Overrides GetHashCode().
(Inherited from SoNetBase.)
Public methodGetMatrix
(Inherited from SoSeparator.)
Public methodGetName

Returns the name of an instance.

(Inherited from SoBase.)
Public methodGetNumChildren

Returns number of children.

(Inherited from SoGroup.)
Public methodGetPrimitiveCount
(Inherited from SoSeparator.)
Public methodGetRenderEngineMode
This override is mandatory to specify the custom node's render engine mode. If not overridden, a warning message will be displayed.
(Overrides SoNodeGetRenderEngineMode.)
Public methodGetRenderUnitID
(Inherited from SoNode.)
Public methodGetShape
Get the shape node that contains the computed vertices and indices. Returns null if no shape has been computed yet. In curve mode this is an SoLineSet. In polygon mode this is an SoIndexedFaceSet. In both cases the vertices are in the shape node's attached SoVertexProperty node's 'vertex' field. The application must not modify these nodes.
Public methodGetStringName (Inherited from SoBase.)
Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Public methodGLRender
(Inherited from SoSeparator.)
Public methodGLRenderBelowPath
(Inherited from SoSeparator.)
Public methodGLRenderInPath
(Inherited from SoSeparator.)
Public methodGLRenderOffPath
(Inherited from SoSeparator.)
Public methodGrabEventsCleanup
(Inherited from SoNode.)
Public methodGrabEventsSetup
(Inherited from SoNode.)
Public methodHandleEvent
(Inherited from SoSeparator.)
Public methodHasDefaultValues

Returns true if all of the object's fields have their default values.

(Inherited from SoFieldContainer.)
Public methodInsertChild

Adds a child so that it becomes the one with the given index.

(Inherited from SoGroup.)
Public methodIsBoundingBoxIgnoring

Used by BoundingBoxAction to known if bounding box computation should be ignored or not.

(Inherited from SoGroup.)
Public methodIsNotifyEnabled

Notification is the process of telling interested objects that this object has changed.

(Inherited from SoFieldContainer.)
Public methodIsOverride

Returns the state of the override flag.

(Inherited from SoNode.)
Public methodIsSynchronizable

Gets the ScaleViz synchronizable state of this object.

(Inherited from SoBase.)
Public methodPick
(Inherited from SoGroup.)
Public methodRayPick
(Inherited from SoSeparator.)
Public methodrecompute
Recompute intersections and (if requested) boundaries.
Public methodRemoveAllChildren

Removes all children from group.

(Inherited from SoGroup.)
Public methodRemoveChild(Int32)

Removes child with given index from group.

(Inherited from SoGroup.)
Public methodRemoveChild(SoNode)

Removes first instance of given child from group.

(Inherited from SoGroup.)
Public methodReplaceChild(Int32, SoNode)

Replaces child with given index with new child.

(Inherited from SoGroup.)
Public methodReplaceChild(SoNode, SoNode)

Replaces first instance of given child with new child.

(Inherited from SoGroup.)
Public methodSearch
(Inherited from SoSeparator.)
Public methodSet

Sets one or more fields in this object to the values specified in the given string, which should be a string in the Open Inventor file format.

(Inherited from SoFieldContainer.)
Public methodSetName (Inherited from SoBase.)
Public methodSetOverride

Turns the override flag on or off.

(Inherited from SoNode.)
Public methodSetSynchronizable

Sets this to be a ScaleViz synchronizable object.

(Inherited from SoBase.)
Public methodSetToDefaults

Sets all fields in this object to their default values.

(Inherited from SoFieldContainer.)
Public methodToString
Converts this SoBase structure to a human readable string.
(Inherited from SoBase.)
Public methodTouch

Marks an instance as modified, simulating a change to it.

(Inherited from SoNode.)
Public methodWrite
(Inherited from SoGroup.)
Top
Fields
  NameDescription
Public fieldautomatic
Specifies whether to recompute the intersection automatically or not (default true). If true, the intersection (curve or polygon depending on the #polygon field) will be re-computed automatically when the scene or the plane changes. If false, the intersection will only be re-computed when the recompute method is called.
Public fieldplane
Plane to intersect with. Default is (1,0,0) at 0 (same as SoClipPlane). Typically this field is connected from the clipping node's 'plane' field.
Public fieldpolygon
Specifies whether to compute a capping polygon (default false). If true, compute a capping polygon. If false, compute only the intersection curve.
Public fieldscene
Scene to intersect with plane. Default is none.
Public fieldtolerance
Tolerance for testing if vertices are equal. Default is 1e-6. This tolerance is used for calculation of triangle intersections with the plane.
Top
Properties
  NameDescription
Public propertyboundingBoxCaching
(Inherited from SoSeparator.)
Public propertyboundingBoxIgnoring

Whether to ignore this node during bounding box traversal.

(Inherited from SoGroup.)
Public propertyfastEditing

Specifies the fast edit mode of the separator node.

(Inherited from SoSeparator.)
Public propertyIsDisposable
ISafeDisposable interface implementation.
(Inherited from SoDisposable.)
Public propertypickCulling

Whether to cull during picking traversal.

(Inherited from SoSeparator.)
Public propertyrenderCaching Obsolete.

Whether to cache during rendering traversal.

(Inherited from SoSeparator.)
Public propertyrenderCulling

Whether to cull during rendering traversal.

(Inherited from SoSeparator.)
Public propertyrenderUnitId

Used during the ScaleViz depth compositing process, this field specifies which render unit (OIRU) will render the sub scene graph below this separator.

(Inherited from SoSeparator.)
Public propertyUserData
Gets or sets the user data to be contained by the field container.
(Inherited from SoFieldContainer.)
Top
Remarks

This class computes and (optionally) renders the intersection of the geometry in the specified scene graph with the specified plane. In curve mode it computes a set of line segments corresponding to the intersection. In polygon mode it computes a set of polygon boundaries that can be used as a "cap" for clipped geometry. The intent is that the specified scene graph is one shape. In fact it can be any scene graph, but the result is always a single polygon with multiple boundaries (if necessary). The computed vertices (and indices in polygon mode) can be accessed using the GetShape() method. The curve or polygon may be exported to a file like any other Open Inventor geometry using SoWriteAction, SoSTLWriteAction, etc.

Curve mode:

By default we compute and render the curve(s) defined by the intersection of the scene geometry and the plane. This is fast and works reliably for any Open Inventor geometry that produces triangles when an SoCallbackAction is applied (almost all Open Inventor geometry nodes). The appearance of the intersection curve can be controlled like any Open Inventor geometry using SoMaterial, SoDrawStyle, etc. nodes. The application may need to use an SoPolygonOffset node to "push" the scene geometry behind the intersection curve (polygon offset does not affect the intersection curve because it is a line set). Curve mode is useful to see where a clip plane intersects the geometry. Because it is much faster than polygon mode it is useful as a preview of where the polygons will be generated (if possible).

Polygon mode:

When the polygon field is set to true, the node converts the intersection curves to polygon boundaries. All the boundaries are stored in an SoIndexedFaceSet node and an SoShapeHints node is created with the 'windingType' field set to ODD_TYPE. All boundaries have counterclockwise vertex ordering and the face normal vector is the opposite of the current plane normal vector (because for a clip plane the plane normal points toward the unclipped half space which is effectively toward the interior of the shape). The appearance of the polygon can be controlled like any Open Inventor geometry using SoMaterial, etc. nodes. There are cases where polygons cannot be constructed, for example if the geometry is self-intersecting.

The coordinates of the intersection boundaries can be accessed using the GetShape() method. This is an SoLineSet in curve mode and an SoIndexedFaceSet in polygon mode. In either case the coordinates are in the shape's attached SoVertexProperty node. Note that in curve mode the line segments are in random order and do not form a connected polyline. This allows the intersection geometry to be computed in minimum time and does not (visually) effect rendering. If you need the boundary(s) as a connected polyline for some purpose, use the polygon mode. Note that in polygon mode there are redundant vertices in the vertex list because it still contains all the line segments. To follow the boundaries in connection order use the coordinate indices in the SoIndexedFaceSet node.

Notes:

  • Multiple boundaries in polygon mode.

    Currently does not test if whether multiple boundaries are "holes" or "islands". Rendering should be correct in either case, but eventually some optimization could be done if all boundaries are disjoint.

  • Memory.

    Memory allocated for vertices and indices is re-used on each recomputation and is not freed until the node is destroyed. This is best for performance. Eventually there should be a method to force memory to be freed.

Limitations:

  • Valid geometry.

    For polygon mode to work correctly, the geometry must obey the same rules as a valid STL geometry. In particular the geometry must form a closed solid and must not be self-intersecting. All the intersection boundaries must be closed and must not intersect any other boundary. However in curve mode, there are no limitations. For example, the node can be used to render the intersection of a surface with a plane.

  • Triangulation of the polygon.

    This node simply computes the intersection boundary(s). For rendering it relies on Open Inventor to convert the polygon to triangles. In many cases the resulting triangles have a poor (large) aspect ratio.

  • Floating point precision.

    Curve mode should work reasonably well with any geometry and any coordinates. However constructing polygon boundaries is very sensitive to floating point precision problems. If the results are not good, try adjusting the tolerance value.

  • Redundant coordinates.

    In polygon mode the SoVertexProperty node contains all the coordinates computed for the intersection line segments. The SoIndexedFaceSet node only indexes a subset of these vertices (typically about half). Not removing the unused vertices saves time and has no effect on rendering. To get only the coordinates that are actually used, extract vertices based on the index values in the SoIndexedFaceSet node. Eventually could be an option.

  • Performamce.

    This is currently a "brute force" implementation and performance could be better.

FILE FORMAT/DEFAULT

PlaneGeometryIntersection {
scene NONE
plane 1 0 0 0
polygon FALSE
automatic TRUE
tolerance 1e-6
}

See Also