Open Inventor Release 2024.1.1
 
Loading...
Searching...
No Matches
SoRayPickAction Class Reference

Intersects objects with a ray cast into scene. More...

#include <Inventor/actions/SoRayPickAction.h>

+ Inheritance diagram for SoRayPickAction:

Public Types

enum  PickingMode {
  DEFAULT ,
  POINT_PICKING
}
 
- Public Types inherited from SoAction
enum  DistribMode {
  LOCAL_ONLY ,
  CLUSTER_ONLY ,
  ALL
}
 This is used to define the way an action is distributed across a cluster. More...
 
enum  AppliedCode {
  NODE ,
  PATH ,
  PATH_LIST
}
 This enum is used to determine what the action is being applied to. More...
 
enum  PathCode {
  NO_PATH ,
  IN_PATH ,
  BELOW_PATH ,
  OFF_PATH
}
 This enum may be used during traversal of nodes to indicate where the node is with respect to the path being traversed. More...
 

Public Member Functions

virtual SoType getTypeId () const
 Returns the type identifier for this specific instance.
 
 SoRayPickAction (const SbViewportRegion &viewportRegion)
 Constructor takes viewport region to use for picking.
 
virtual void clearApplyResult ()
 Clears the picked point list.
 
void setPickingMode (PickingMode pickingMode)
 Sets the picking mode.
 
PickingMode getPickingMode () const
 Returns the PickingMode used for the ray pick action.
 
virtual void setPoint (const SbVec2s &viewportPoint)
 Sets the viewport point through which the ray passes, starting at the camera position.
 
virtual void setPoint (const SbVec2f &viewportPoint)
 Float version of setPoint.
 
const SbVec2sgetPoint () const
 Gets the viewport point in pixels (returns the last value passed to setPoint).
 
const SbVec2fgetPointFloat () const
 Float version of getPoint().
 
virtual void setNormalizedPoint (const SbVec2f &normPoint)
 Sets the viewport point in normalized coordinates, which range from (0,0) at the lower left to (1,1) at the upper right.
 
const SbVec2f getNormalizedPoint () const
 Gets the viewport point in normalized coordinates [0..1] (returns the last value passed to setNormalizedPoint).
 
void setRadius (float radius)
 Sets the radius around the point.
 
float getRadius () const
 Gets the radius (in pixels) around the point.
 
virtual void setRay (const SbVec3f &start, const SbVec3f &direction, float nearDistance=-1.0, float farDistance=-1.0)
 Sets a world-space ray along which to pick.
 
virtual void setRay (float fovy, const SbVec3f &start, const SbVec3f &direction, float nearDistance=-1.0, float farDistance=-1.0)
 Sets a world-space ray along which to pick in the the same way as the other version of setRay(), but allows you to set a view angle value.
 
void setPickAll (SbBool flag)
 Sets whether the action will return all objects intersected or just the closest one.
 
SbBool isPickAll () const
 Returns whether the action will return all objects intersected or just the closest one.
 
const SoPickedPointListgetPickedPointList () const
 Returns list of picked points.
 
SoPickedPointgetPickedPoint (int index=0) const
 Returns the indexed picked point from the list.
 
SoDEPRECATED void clearPickedPointList ()
 Clears the picked point list.
 
void enableRadiusForTriangles (SbBool flag)
 Enable radius for triangle-based shape.
 
SbBool isRadiusEnableForTriangles ()
 Returns whether the pick radius specified by setRadius is taken into account for picking on triangle-based shapes.
 
void enableTexCoordsGeneration (const SbBool enable)
 Enables generation of texture coordinates for picked points.
 
void enableNormalsGeneration (const SbBool enable)
 Enables generation of normal vectors for picked points.
 
SbBool isTexCoordsGenerationEnabled () const
 Returns whether texture coordinate generation is enabled for picked points.
 
SbBool isNormalsGenerationEnabled () const
 Returns whether generation of normal vectors is enabled for picked points.
 
void enableConicPickVolume (SbBool flag)
 Controls the pick volume shape for picking with setRay().
 
SbBool isConicPickVolume ()
 Returns TRUE if the picking volume is a conic shape (not a frustum).
 
virtual void apply (SoNode *node)
 Initiates an action on the graph defined by a node.
 
virtual void apply (SoPath *path)
 Initiates an action on the graph defined by a path.
 
virtual void apply (const SoPathList &pathList, SbBool obeysRules=FALSE)
 Initiates an action on the graph defined by a list of paths.
 
- Public Member Functions inherited from SoPickAction
void setViewportRegion (const SbViewportRegion &newRegion)
 Sets current viewport region to use for action.
 
const SbViewportRegiongetViewportRegion () const
 Returns current viewport region to use for action.
 
void enableCulling (SbBool flag)
 
SbBool isCullingEnabled () const
 
- Public Member Functions inherited from SoAction
virtual ~SoAction ()
 Destructor.
 
virtual void invalidateState ()
 Invalidates the current traversal state in the action, forcing it to be recreated when the action is next applied.
 
void stopActionInBranch ()
 This function stops the action in the current Scene Graph branch.
 
SbBool getContinueActionInBranchFlag () const
 This function indicates if the action must stop in the current branch.
 
void resetContinueActionInBranchFlag ()
 This function resets the continue action flag.
 
void useAlternateRep (const SbBool enable)
 Tell the action to use alternate representations during traversal when available.
 
SbBool isUsingAlternateRep () const
 Returns TRUE if current action is using alternate representations.
 
void setSceneManager (SoSceneManager *mgr)
 Set the scene manager associated with this action (if any ).
 
SoSceneManagergetSceneManager () const
 Return the SoSceneManager associated with this action.
 
virtual void forwardTraversal (SoNode *node)
 Traverse a node that is not part of the current scenegraph.
 
virtual void forwardTraversal (SoPath *path)
 Traverse a path that is not part of the current scenegraph.
 
DistribMode getDistribMode () const
 Returns the distribution mode of this action across a cluster (ScaleViz-Cluster only).
 
AppliedCode getWhatAppliedTo () const
 Returns code indicating what action is being applied to.
 
SoNodegetNodeAppliedTo () const
 Returns the node the action is being applied to.
 
SoPathgetPathAppliedTo () const
 Returns the path the action is being applied to.
 
const SoPathListgetPathListAppliedTo () const
 Returns the path list the action is being applied to.
 
const SoPathListgetOriginalPathListAppliedTo () const
 Returns the original path list the action is being applied to.
 
SbBool isLastPathListAppliedTo () const
 Returns TRUE if the current list is the last one from the original.
 
PathCode getPathCode (int &numIndices, const int *&indices)
 Returns path code based on where current node (the node at the end of the current path) lies with respect to the path(s) the action is being applied to.
 
PathCode getPathCodeMI (int &numIndices, const int *&indices, const int *&instanceIndices)
 Extender API: available to programmers who wish to extend the toolkit
 
void traverse (SoNode *node)
 Does traversal of a graph rooted by a node.
 
SbBool hasTerminated () const
 Returns TRUE if the traversal has reached a termination condition.
 
const SoPathgetCurPath ()
 Returns the path accumulated during traversal, i.e., the chain of nodes from the root of the traversed graph to the current node being traversed.
 
SoStategetState () const
 Gets the state from the action.
 
virtual void setUpState ()
 Creates state if it is NULL or it is no longer valid because new elements have been enabled since it was created.
 
void setPipeId (int id)
 Sets pipe identifier in the range [1..N] associated to this render action while running a ScaleViz Multipipe configuration.
 
int getPipeId () const
 Gets pipe identifier in the range [1..N] associated to this render action while running a ScaleViz Multipipe configuration.
 
bool isBeingApplied ()
 Returns TRUE if this action is currently being applied.
 
virtual bool preDelayedTraversal ()
 Method called by SoMultiPassManager before delayed pass traversals.
 
virtual void postDelayedTraversal ()
 Method called by SoMultiPassManager after delayed pass traversals.
 
- Public Member Functions inherited from SoTypedObject
SbBool isOfType (const SoType &type) const
 Returns TRUE if this object is of the type specified in type or is derived from that type.
 
template<typename TypedObjectClass >
SbBool isOfType () const
 Returns TRUE if this object is of the type of class TypedObjectClass or is derived from that class.
 

Static Public Member Functions

static SoType getClassTypeId ()
 Returns the type identifier for this class.
 
static void setStereoMode (SoCamera::StereoMode stereoMode)
 Tells ray pick action in which view the pick occurs.
 
static SoCamera::StereoMode getStereoMode ()
 Returns the view used to perform pick when stereo is active.
 
static void enableTriangleCulling (SbBool flag)
 Enables culling of triangles relative to the ray frustum.
 
static SbBool isTriangleCulling ()
 Returns whether triangle culling is enabled.
 
- Static Public Member Functions inherited from SoPickAction
static SoType getClassTypeId ()
 Returns the type identifier for this class.
 
- Static Public Member Functions inherited from SoAction
static SoType getClassTypeId ()
 Returns the type identifier for this class.
 
static void nullAction (SoAction *, SoNode *)
 Null action method that can be stored in lookup table when desired.
 
- Static Public Member Functions inherited from SoTypedObject
static SoType getClassTypeId ()
 Returns the type identifier for this class.
 

Detailed Description

Intersects objects with a ray cast into scene.

This class performs picking by casting a ray into a scene and performing intersection tests with each object. The ray is extended to be a frustum a pyramid or a rectangular prism, a cone or a cylinder, depending on the camera type and client inputs (refer to setRay and enableConicPickVolume) for intersection with points and lines. Each intersection is returned as an SoPickedPoint instance.

The picking ray can be specified as either a ray from the camera location through a particular viewport pixel, or as a world-space ray.
Calling any of the setPoint, setNormalizedPoint, or setRadius methods tells the action to compute the picking ray from a viewport pixel. In this case, a camera node must be encountered during traversal of the scene graph in order to determine the location of the ray in world space.

Callers can request the action to compute all intersections along the ray (sorted closest to farthest) by setting the pickAll flag to TRUE. By default, the action computes only the closest intersection. In either case, the intersections are returned in an SoPickedPointList. Each intersection can be examined by accessing the appropriate SoPickedPoint in the list. The SoPickedPoint object provides methods to get the path (SoPath) to the picked geometry in the scene graph, the intersection point in 3D space and other info.

The SoPickedPoint object can also return one of the subclasses of SoDetail, which contains more information about the picked geometry. For example, if a polygonal geometry node like SoIndexedFaceSet was picked, an SoFaceDetail object is returned which provides methods to get the index of the face in the primitive, the vertices of the face and so on. For vertex based geometry each vertex can then be queried as an SoPointDetail.
Note: Texture coordinates for the picked point are not computed by default (to save time). If you need this information, use enableTexCoordsGeneration(). Or set the environment variable OIV_PICK_GENERATE_ALL_PROPERTIES. You can also disable computing the normal vector for the picked if you do not need this information. See enableNormalsGeneration().

In the default mode, Inventor computes the intersection of the pick ray with geometry nodes (face, line, point, volume, mesh, etc). In this case SoPickedPoint::getPoint() returns the coordinate of the intersection and SoPickedPoint::getDetail() typically returns an SoDetail class specific to the picked geometry. Since Open Inventor 9.0, SoRayPickAction also supports a POINT_PICKING mode (see PickingMode). In this mode, Inventor finds all the vertices inside the pick radius. This is only supported for SoBufferedShape and classes derived from SoIndexedShape. This mode can be much faster because, for example, it does not need to check for intersection with all the triangles of an SoIndexedFaceSet.

Applications can use the SoPickStyle node to control if and how geometry can be picked. For example application might want to specify that annotation geometry, e.g. a legend, is not pickable. It can also specify that geometry should be picked using its bounding box rather than exact geometry. This may be more efficient for text strings when it is not necessary to know which character in the string was picked.

The application can get platform independent input events, e.g. mouse button press, as SoEvent objects using the SoEventCallback node. In the callback function the application can create an SoRayPickAction and apply it to the scene graph. Note however that the application can also simply call the node's getPickedPoint() method. In this case Open Inventor automatically applies a pick action to the scene graph and returns the result, so the application does not need to use SoRayPickAction directly. Creating and using an SoRayPickAction explicitly does allow more options to be set. In this case the application will normally call setPoint with the position obtained from the event object. If using system events directly, remember that Open Inventor expects Y pixel values to start from zero at the bottom of the window.

The SoSelection node provides an even higher level way to manage selecting and de-selecting objects in the scene. This node automatically applies a pick action and maintains a list of currently selected objects (paths). Using SoSelection the application does not need to use SoRayPickAction directly. The SoExtSelection node provides more complex picking algorithms. For example it allows the user to select objects using a "rubberband" rectangle or a freeform shape (lasso). Open Inventor provides special render actions that can automatically highlight objects selected using an SoSelection or SoExtSelection node. See SoBoxHighlightRenderAction, SoHaloHighlightRenderAction and SoLineHighlightRenderAction.

Picking algorithm on vertex shapes

Open Inventor implements two different picking algorithms : the GPU picking algorithm and the CPU picking algorithm.

The GPU picking algorithm is very efficient when the shapes have millions of polygons. It is used when :

  • The shape is compatible with GPU picking.
    Note: For now, this is limited to MeshVizXLM surface shapes if enhanced coloring is not enabled.
  • The MeshVizXLM shape has a MoDrawStyle with the flag displayFaces set to TRUE.
  • The picking mode is DEFAULT, see setPickingMode().
  • The pick all is FALSE, see setPickAll().
  • The picked shape is not in an SoRenderToTarget.
  • The action is associated with a scene manager, see setSceneManager().

The CPU picking algorithm is used when the previous conditions are not met. In this case, it does true geometric picking in 3D coordinates, so there are no limits the number of objects that can be picked. Geometric picking means that precise intersections with the geometry are computed. It also means that picking works for any type of primitive, including polygonal geometry, meshes and volumes (VolumeViz). The picking volume can be projected through the scene using orthogonal or perspective projection. See setRay for details. The shape of the picking volume can be rectangular (prism if orthogonal, frustum if perspective) or conic (cylinder if orthogonal, cone if perspective). See enableConicPickVolume().

It is possible to mix GPU picking compatible and incompatible shapes in the same scenegraph, GPU picking will be automatically used for compatible shapes and CPU picking will be used for the others.

CPU picking optimization

Pick traversals are optimized using hierarchical bounding boxes cached at the SoSeparator (and a few other) grouping nodes. If the pick ray does not intersect the bounding box then the pick action will not traverse the children of that separator. When optimizing for picking the application should consider first how quickly can Open Inventor find the geometry that should be picked. Organizing the scene graph spatially to take advantage of the bounding box optimization can help with this. Second the application should consider how long will it take to find the face that should be picked. For a very large surface this can be significant. Enabling triangle culling, splitting large surfaces into smaller pieces or using proxy geometry may be helpful.

Traversing the camera node:

Note that when using SoRayPickAction with pixel coordinates (setPoint()) the pick action must traverse a camera node in order to unproject the coordinate back into 3D space. If the application explicitly creates its own camera, this is usually not a problem because the camera is in the application scene graph. However if the application allows the viewer to automatically create a camera then the camera is in the viewer's scene graph above the application scene graph. Calling the viewer's getSceneGraph() method returns the application scene graph, not the complete viewer scene graph. To ensure that the traversed scene graph contains a camera, call the viewer's getSceneManager() method, then call the scene manager's getSceneGraph method. Alternatively, in an event callback call the event action's getPickRoot() method.

Picking SoVolumeRender nodes:

Since Open Inventor 8.6, the SoVolumeRender node (by default) uses the GPU to compute the picked voxel during an SoRayPickAction. For this to work, the SoRayPickAction must have its scene manager initialised using the method SoAction::setSceneManager(). SoHandleEventAction does this automatically, so it is not necessary for the application to take any action when using (for example) an SoEventCallback node and calling the getPickedPoint() method. However if the application creates its own SoRayPickAction then it should set the scene manager. If no scene manager is specified, a warning message is issued and software picking is done. If necessary, using the GPU for volume picking may be disabled by setting the environment variable IVVR_GPU_PICKING to 0 (see SoPreferences).

Hidden references:

SoRayPickAction creates one or more SoPath objects when applied to the scene graph. An SoPath object calls ref() on each node in the path. This reference will prevent the node from being destroyed for as long as the SoPath object exists. These SoPath objects are stored internally in the action and exist until the action object itself is destroyed or reset (see clearApplyResult()).

Shapes that redefine the rayPick method:

In order to make this action work properly with respect to the picked path stored in the picked point list, any shape that redefines the rayPick method must either call the method SoRayPickAction::setObjectSpace() or the method SoShape::computeObjectSpaceRay() in its rayPick method before calling the addIntersection() methods. See the chapter "Creating a node - Creating a Shape Node - Picking" in the Inventor Toolmaker Volume 1.

Sets: SoPickRayElement, SoViewportRegionElement

EXAMPLE

SEE ALSO

SoPickedPoint, SoPickedPointList, SoPickStyle

Definition at line 349 of file SoRayPickAction.h.

Member Enumeration Documentation

◆ PickingMode

Enumerator
DEFAULT 

In the default mode, Inventor computes the intersection of the pick ray with geometry nodes (face, line, point, volume, mesh, etc).

SoPickedPoint::getPoint() returns the coordinate of the intersection and SoPickedPoint::getDetail() returns (usually) an SoDetail class specific to the picked geometry.

POINT_PICKING 

In this mode, Inventor finds all the vertices inside the pick radius.

However this is only supported for SoBufferedShape and classes derived from SoIndexedShape. This mode can be much faster because, for example, it does not need to check for intersection with the triangles of an SoIndexedFaceSet. For pick radius see setRadius(). Specific different behaviors include:

  • If no vertex is inside the pick radius, no picked point is returned.
  • If a vertex is inside the pick radius, SoPickedPoint->getPoint() returns the coordinate of the vertex, not the intersection with the geometry.
  • SoPickedPoint->getNormal() returns 0,0,0
  • SoPickedPoint->getTextureCoords() returns 0,0,0,0
  • SoPickedPoint->getDetail normally returns an SoPointDetail instead of an SoFaceDetail (or whatever would normally be returned for that geometry).

Definition at line 394 of file SoRayPickAction.h.

Constructor & Destructor Documentation

◆ SoRayPickAction()

SoRayPickAction::SoRayPickAction ( const SbViewportRegion viewportRegion)

Constructor takes viewport region to use for picking.

Even though the picking operation may not involve a window per se, some nodes need this information to determine their size and placement.

Member Function Documentation

◆ apply() [1/3]

virtual void SoRayPickAction::apply ( const SoPathList pathList,
SbBool  obeysRules = FALSE 
)
inlinevirtual

Initiates an action on the graph defined by a list of paths.

TRUE can be passed for the obeysRules flag if the given path list has the following 4 properties:

  1. All paths have the same head node.
  2. Paths are sorted in traversal order.
  3. If one path ends at node A, no other path continues through A.
  4. No two paths are the same.

These rules will be obeyed by path lists returned by picking and by searches for non-group nodes.

Reimplemented from SoAction.

Definition at line 704 of file SoRayPickAction.h.

◆ apply() [2/3]

virtual void SoRayPickAction::apply ( SoNode node)
virtual

Initiates an action on the graph defined by a node.

Warning: Most actions call ref() on the node before traversing the scene graph, then call unref() after traversal. If the node's reference count was zero (the default), the call to apply() will cause it to be destroyed.

Reimplemented from SoAction.

◆ apply() [3/3]

virtual void SoRayPickAction::apply ( SoPath path)
virtual

Initiates an action on the graph defined by a path.

Warning: Most actions call ref() on the path before traversing the scene graph, then call unref() after traversal. If the path's reference count was zero (the default), the call to apply() will cause it to be destroyed.

Reimplemented from SoAction.

◆ clearApplyResult()

virtual void SoRayPickAction::clearApplyResult ( )
virtual

Clears the picked point list.

The picked point list is automatically cleared when the action is destroyed or re-applied. However it may be useful to clear the list explicitly in order to remove references to picked node(s).

Reimplemented from SoAction.

◆ clearPickedPointList()

SoDEPRECATED void SoRayPickAction::clearPickedPointList ( )

Clears the picked point list.

The picked point list is automatically cleared when the action is destroyed or re-applied. However it may be useful to clear the list explicitly in order to remove references to picked node(s).

◆ enableConicPickVolume()

void SoRayPickAction::enableConicPickVolume ( SbBool  flag)

Controls the pick volume shape for picking with setRay().

The default is FALSE, meaning that the picking volume is a rectangular shape, either a prism or a frustum (depending on which version of setRay was called). When enableConicPickVolume is TRUE the picking volume is a conic shape, either a cylinder or a cone (depending on which version of setRay was called).

Setting enableConicPickVolume to TRUE ensures that the entities picked using setRay() will be the same as picking using an equivalent call to setPoint(), but this mode is slightly more costly than frustum picking.

◆ enableNormalsGeneration()

void SoRayPickAction::enableNormalsGeneration ( const SbBool  enable)

Enables generation of normal vectors for picked points.

Default is TRUE.

◆ enableRadiusForTriangles()

void SoRayPickAction::enableRadiusForTriangles ( SbBool  flag)
inline

Enable radius for triangle-based shape.

If TRUE, the radius of the ray specified by setRadius is taken in account when checking for a ray intersection with triangle-based shapes (e.g., SoCylinder). Otherwise, the pick radius for these shapes is 1 pixel regardless of the specified pick radius. Default is FALSE for performance.

Definition at line 1105 of file SoRayPickAction.h.

◆ enableTexCoordsGeneration()

void SoRayPickAction::enableTexCoordsGeneration ( const SbBool  enable)

Enables generation of texture coordinates for picked points.

Default is FALSE for performance (unless environment variable OIV_PICK_GENERATE_ALL_PROPERTIES envvar is set to TRUE).

◆ enableTriangleCulling()

static void SoRayPickAction::enableTriangleCulling ( SbBool  flag)
static

Enables culling of triangles relative to the ray frustum.

Enabling culling improves performance for shapes containing a large number of triangles. Default is FALSE.

◆ getClassTypeId()

static SoType SoRayPickAction::getClassTypeId ( )
static

Returns the type identifier for this class.


◆ getNormalizedPoint()

const SbVec2f SoRayPickAction::getNormalizedPoint ( ) const
inline

Gets the viewport point in normalized coordinates [0..1] (returns the last value passed to setNormalizedPoint).

A point is inside the viewport if its coordinates are in the range [0, 1].

If no point has been set or the setRay method was called instead of setXXXPoint, this method returns an undefined coordinate (NaN, NaN).

Definition at line 486 of file SoRayPickAction.h.

◆ getPickedPoint()

SoPickedPoint * SoRayPickAction::getPickedPoint ( int  index = 0) const

Returns the indexed picked point from the list.

Returns NULL if index is larger than the number of picked points.

Note: Each SoPickedPoint object contains an SoPath with the path to the picked node; therefore the picked node's ref count has been incremented and will remain incremented until the SoPickedPoint object is destroyed.

The SoPickedPoint object is owned by the pick action. It will be destroyed when the action is destroyed or when either apply() or clearApplyResult() is called.

◆ getPickedPointList()

const SoPickedPointList & SoRayPickAction::getPickedPointList ( ) const

Returns list of picked points.

This results in a copy of the picked point list and a copy of every SoPickedPoint object in the list.

◆ getPickingMode()

PickingMode SoRayPickAction::getPickingMode ( ) const

Returns the PickingMode used for the ray pick action.

◆ getPoint()

const SbVec2s & SoRayPickAction::getPoint ( ) const
inline

Gets the viewport point in pixels (returns the last value passed to setPoint).

Definition at line 459 of file SoRayPickAction.h.

◆ getPointFloat()

const SbVec2f & SoRayPickAction::getPointFloat ( ) const
inline

Float version of getPoint().

It can be used when a desktop is magnified on a wall of screens using ScaleViz with a tracker device calibrated for this wall.

Definition at line 466 of file SoRayPickAction.h.

◆ getRadius()

float SoRayPickAction::getRadius ( ) const
inline

Gets the radius (in pixels) around the point.

Definition at line 514 of file SoRayPickAction.h.

◆ getStereoMode()

static SoCamera::StereoMode SoRayPickAction::getStereoMode ( )
static

Returns the view used to perform pick when stereo is active.

◆ getTypeId()

virtual SoType SoRayPickAction::getTypeId ( ) const
virtual

Returns the type identifier for this specific instance.

Reimplemented from SoPickAction.

◆ isConicPickVolume()

SbBool SoRayPickAction::isConicPickVolume ( )
inline

Returns TRUE if the picking volume is a conic shape (not a frustum).

Definition at line 694 of file SoRayPickAction.h.

◆ isNormalsGenerationEnabled()

SbBool SoRayPickAction::isNormalsGenerationEnabled ( ) const

Returns whether generation of normal vectors is enabled for picked points.

See enableNormalsGeneration().

◆ isPickAll()

SbBool SoRayPickAction::isPickAll ( ) const
inline

Returns whether the action will return all objects intersected or just the closest one.

Definition at line 572 of file SoRayPickAction.h.

◆ isRadiusEnableForTriangles()

SbBool SoRayPickAction::isRadiusEnableForTriangles ( )
inline

Returns whether the pick radius specified by setRadius is taken into account for picking on triangle-based shapes.

Definition at line 1111 of file SoRayPickAction.h.

◆ isTexCoordsGenerationEnabled()

SbBool SoRayPickAction::isTexCoordsGenerationEnabled ( ) const

Returns whether texture coordinate generation is enabled for picked points.

See enableTexCoordsGeneration().

◆ isTriangleCulling()

static SbBool SoRayPickAction::isTriangleCulling ( )
inlinestatic

Returns whether triangle culling is enabled.

Definition at line 648 of file SoRayPickAction.h.

◆ setNormalizedPoint()

virtual void SoRayPickAction::setNormalizedPoint ( const SbVec2f normPoint)
virtual

Sets the viewport point in normalized coordinates, which range from (0,0) at the lower left to (1,1) at the upper right.

NOTE: You can use this method or setPoint or setRay. Whichever method you call last is the one that takes effect.

◆ setPickAll()

void SoRayPickAction::setPickAll ( SbBool  flag)
inline

Sets whether the action will return all objects intersected or just the closest one.

Default is FALSE (only closest intersection).

Definition at line 565 of file SoRayPickAction.h.

◆ setPickingMode()

void SoRayPickAction::setPickingMode ( PickingMode  pickingMode)

Sets the picking mode.

Use enum PickingMode. Default value is PickingMode::DEFAULT

◆ setPoint() [1/2]

virtual void SoRayPickAction::setPoint ( const SbVec2f viewportPoint)
virtual

Float version of setPoint.

It can be used when a desktop is magnified on a wall of screens using ScaleViz with a tracker device calibrated for this wall.

NOTE: You can use this method or setNormalizedPoint or setRay. Whichever method you call last is the one that takes effect.

◆ setPoint() [2/2]

virtual void SoRayPickAction::setPoint ( const SbVec2s viewportPoint)
virtual

Sets the viewport point through which the ray passes, starting at the camera position.

Viewport coordinates range from (0,0) at the lower left to (width-1,height-1) at the upper right. Default is (0,0).

NOTE: You can use this method or setNormalizedPoint or setRay. Whichever method you call last is the one that takes effect.

◆ setRadius()

void SoRayPickAction::setRadius ( float  radius)

Sets the radius around the point.

The radius is defined in pixels when defining a ray using the setPoint or setNormalizedPoint method, and is defined in world coordinates, when the ray is defined using the setRay method. By default, for the setPoint and setNormalizedPoint method the radius is 5 pixels.

By default, the radius is not taken into account for triangle based shapes, only for points and lines. To enable this use the enableRadiusForTriangles method. When radius is taken into account, the ray is extended in 3D space. For perspectivecameras, the ray is extended to be a cone. For orthographic cameras, the ray is extended to be a cylinder.

Specifying a radius of 0 may give better performance. In particular, some shapes like MoMeshSkin implement a fast GPU picking algorithm that can only be used when radius is 0.

See also SoQtViewer::setPickRadius(), SoWinViewer::setPickRadius(), SoXtViewer::setPickRadius.

◆ setRay() [1/2]

virtual void SoRayPickAction::setRay ( const SbVec3f start,
const SbVec3f direction,
float  nearDistance = -1.0,
float  farDistance = -1.0 
)
virtual

Sets a world-space ray along which to pick.

The ray is defined as a world space starting point and direction vector. The direction vector will be normalized automatically. The last two arguments specify optional near and far plane clipping during the pick operation. These values are distances from the start point along the direction vector, similar to nearDistance and farDistance in SoCamera. A negative distance (such as the default values) means disable clipping to that plane.

The ray-picking is orthogonal. This means the pick volume is a rectangular prism with a square base having edges of length setRadius * 2 or else a cylinder having radius setRadius if enableConicPickVolume is set to TRUE.

NOTE: You can use this method or the setPoint / setNormalizedPoint Whichever method you call last is the one that takes effect.

◆ setRay() [2/2]

virtual void SoRayPickAction::setRay ( float  fovy,
const SbVec3f start,
const SbVec3f direction,
float  nearDistance = -1.0,
float  farDistance = -1.0 
)
virtual

Sets a world-space ray along which to pick in the the same way as the other version of setRay(), but allows you to set a view angle value.

The ray is defined as a world space starting point and direction vector. The direction vector will be normalized automatically. The last two arguments specify optional near and far plane clipping during the pick operation. These values are distances from the start point along the direction vector, similar to nearDistance and farDistance in SoCamera. A negative distance (such as the default values) means disable clipping to that plane.

If fovy is non-zero, perspective ray-picking is used. This means the pick volume is a frustum intersecting the plane passing through the point specified as start argument and having normal vector specified by the direction argument and whose base is a square having edges of length setRadius * 2 or else a circle of radius setRadius if enableConicPickVolume is set to TRUE.

NOTE: You can use this method or the setPoint / setNormalizedPoint Whichever method you call last is the one that takes effect.

◆ setStereoMode()

static void SoRayPickAction::setStereoMode ( SoCamera::StereoMode  stereoMode)
static

Tells ray pick action in which view the pick occurs.

When stereo mode is active, user can choose between left, right, or normal view to perform the action. Only applicable when stereo is active. Default is LEFT_VIEW.


The documentation for this class was generated from the following file: