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.
Namespace: OIV.Medical.Nodes
The PlaneGeometryIntersection type exposes the following members.
Name | Description | |
---|---|---|
PlaneGeometryIntersection |
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.
|
Name | Description | |
---|---|---|
AddChild | Adds a child as last one in group. | |
AffectsState | Returns true if a node has an effect on the state during traversal. | |
Callback | (Inherited from SoSeparator.) | |
ClearCacheList | (Inherited from SoSeparator.) | |
Copy | Calls Copy(false). (Inherited from SoNode.) | |
Copy(Boolean) | Creates and returns an exact copy of the node. | |
CopyFieldValues(SoFieldContainer) | Calls CopyFieldValues(fc, false). (Inherited from SoFieldContainer.) | |
CopyFieldValues(SoFieldContainer, Boolean) | Copies the contents of fc's fields into this object's fields. | |
Dispose |
Releases all resources used by SoDisposable.
(Inherited from SoDisposable.) | |
Distribute | (Inherited from SoNode.) | |
DoAction | (Inherited from SoSeparator.) | |
EnableNotify | Notification at this Field Container is enabled (if flag == true) or disabled (if flag == false). | |
Equals | Determines whether the specified Object is equal to the current Object. (Inherited from Object.) | |
FieldsAreEqual | Returns true if this object's fields are exactly equal to fc's fields. | |
FindChild | Finds index of given child within group. | |
Get | Returns the values of the fields of this object in the Open Inventor ASCII file format in the given string. | |
GetAllFields | Returns a list of fields, including the eventIn's and eventOut's. | |
GetAlternateRep | This method is called by actions to allow the node to provide an "alternate representation" when appropriate (typically depending on the action type). | |
GetBoundingBox | (Inherited from SoSeparator.) | |
GetChild | Returns pointer the child node with the given index. | |
GetEventIn | Returns a the eventIn with the given name. | |
GetEventOut | Returns the eventOut with the given name. | |
GetField | Returns a the field of this object whose name is fieldName. | |
GetFieldName | Returns the name of the given field in the fieldName argument. | |
GetFields | Appends references to all of this object's fields to resultList, and returns the number of fields appended. | |
GetHashCode |
Overrides GetHashCode().
(Inherited from SoNetBase.) | |
GetMatrix | (Inherited from SoSeparator.) | |
GetName | Returns the name of an instance. | |
GetNumChildren | Returns number of children. | |
GetPrimitiveCount | (Inherited from SoSeparator.) | |
GetRenderEngineMode |
This override is mandatory to specify the custom node's render
engine mode. If not overridden, a warning message will be displayed.
(Overrides SoNodeGetRenderEngineMode.) | |
GetRenderUnitID | (Inherited from SoNode.) | |
GetShape |
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.
| |
GetStringName | (Inherited from SoBase.) | |
GetType | Gets the Type of the current instance. (Inherited from Object.) | |
GLRender | (Inherited from SoSeparator.) | |
GLRenderBelowPath | (Inherited from SoSeparator.) | |
GLRenderInPath | (Inherited from SoSeparator.) | |
GLRenderOffPath | (Inherited from SoSeparator.) | |
GrabEventsCleanup | (Inherited from SoNode.) | |
GrabEventsSetup | (Inherited from SoNode.) | |
HandleEvent | (Inherited from SoSeparator.) | |
HasDefaultValues | Returns true if all of the object's fields have their default values. | |
InsertChild | Adds a child so that it becomes the one with the given index. | |
IsBoundingBoxIgnoring | Used by BoundingBoxAction to known if bounding box computation should be ignored or not. | |
IsNotifyEnabled | Notification is the process of telling interested objects that this object has changed. | |
IsOverride | Returns the state of the override flag. | |
IsSynchronizable | Gets the ScaleViz synchronizable state of this object. | |
Pick | (Inherited from SoGroup.) | |
RayPick | (Inherited from SoSeparator.) | |
recompute |
Recompute intersections and (if requested) boundaries.
| |
RemoveAllChildren | Removes all children from group. | |
RemoveChild(Int32) | Removes child with given index from group. | |
RemoveChild(SoNode) | Removes first instance of given child from group. | |
ReplaceChild(Int32, SoNode) | Replaces child with given index with new child. | |
ReplaceChild(SoNode, SoNode) | Replaces first instance of given child with new child. | |
Search | (Inherited from SoSeparator.) | |
Set | 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. | |
SetName | (Inherited from SoBase.) | |
SetOverride | Turns the override flag on or off. | |
SetSynchronizable | Sets this to be a ScaleViz synchronizable object. | |
SetToDefaults | Sets all fields in this object to their default values. | |
ToString |
Converts this SoBase structure to a human readable string.
(Inherited from SoBase.) | |
Touch | Marks an instance as modified, simulating a change to it. | |
Write | (Inherited from SoGroup.) |
Name | Description | |
---|---|---|
automatic |
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.
| |
plane |
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.
| |
polygon |
Specifies whether to compute a capping polygon (default false).
If true, compute a capping polygon. If false, compute only the intersection curve.
| |
scene |
Scene to intersect with plane. Default is none.
| |
tolerance |
Tolerance for testing if vertices are equal.
Default is 1e-6. This tolerance is used for calculation of triangle
intersections with the plane.
|
Name | Description | |
---|---|---|
boundingBoxCaching | (Inherited from SoSeparator.) | |
boundingBoxIgnoring | Whether to ignore this node during bounding box traversal. | |
fastEditing | Specifies the fast edit mode of the separator node. | |
IsDisposable | ISafeDisposable interface implementation.
(Inherited from SoDisposable.) | |
pickCulling | Whether to cull during picking traversal. | |
renderCaching | Obsolete. Whether to cache during rendering traversal. | |
renderCulling | Whether to cull during rendering traversal. | |
renderUnitId | Used during the ScaleViz depth compositing process, this field specifies which render unit (OIRU) will render the sub scene graph below this separator. | |
UserData |
Gets or sets the user data to be contained by the field container.
(Inherited from SoFieldContainer.) |
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.
PlaneGeometryIntersection {
scene | NONE |
plane | 1 0 0 0 |
polygon | FALSE |
automatic | TRUE |
tolerance | 1e-6 |