Class SoRayPickAction
- java.lang.Object
-
- com.openinventor.inventor.Inventor
-
- com.openinventor.inventor.actions.SoAction
-
- com.openinventor.inventor.actions.SoPickAction
-
- com.openinventor.inventor.actions.SoRayPickAction
-
public class SoRayPickAction extends SoPickAction
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 tosetRay
andenableConicPickVolume
) for intersection with points and lines. Each intersection is returned as anSoPickedPoint
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
, orsetRadius
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. TheSoPickedPoint
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 ofSoDetail
, which contains more information about the picked geometry. For example, if a polygonal geometry node likeSoIndexedFaceSet
was picked, anSoFaceDetail
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 anSoPointDetail
.
Note: Texture coordinates for the picked point are not computed by default (to save time). If you need this information, useenableTexCoordsGeneration()
. 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. SeeenableNormalsGeneration()
.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 andSoPickedPoint.getDetail()
typically returns anSoDetail
class specific to the picked geometry. Since Open Inventor 9.0,SoRayPickAction
also supports a POINT_PICKING mode (seePickingMode
). In this mode, Inventor finds all the vertices inside the pick radius. This is only supported forSoBufferedShape
and classes derived fromSoIndexedShape
. This mode can be much faster because, for example, it does not need to check for intersection with all the triangles of anSoIndexedFaceSet
.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 theSoEventCallback
node. In the callback function the application can create anSoRayPickAction
and apply it to the scene graph. Note however that the application can also simply call the node'sgetPickedPoint()
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 useSoRayPickAction
directly. Creating and using anSoRayPickAction
explicitly does allow more options to be set. In this case the application will normally callsetPoint
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). UsingSoSelection
the application does not need to useSoRayPickAction
directly. TheSoExtSelection
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 anSoSelection
orSoExtSelection
node. SeeSoBoxHighlightRenderAction
,SoHaloHighlightRenderAction
andSoLineHighlightRenderAction
.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). SeeenableConicPickVolume()
.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'sgetSceneManager()
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 anSoRayPickAction
. For this to work, theSoRayPickAction
must have its scene manager initialised using the methodSoAction.setSceneManager()
.SoHandleEventAction
does this automatically, so it is not necessary for the application to take any action when using (for example) anSoEventCallback
node and calling thegetPickedPoint()
method. However if the application creates its ownSoRayPickAction
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 (seeSoPreferences
).Hidden references:
SoRayPickAction
creates one or moreSoPath
objects when applied to the scene graph. TheSoPath
object references each node in the path. This reference will prevent the node and its associated memory from being reclaimed for as long as theSoPath
object exists. TheseSoPath
objects are stored internally in the action and exist until the action object itself is reclaimed 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 theaddIntersection()
methods. See the chapter "Creating a node - Creating a Shape Node - Picking" in the Inventor Toolmaker Volume 1.Sets:
SoPickRayElement
,SoViewportRegionElement
EXAMPLE Do picking using an
SoEventCallback
node.
Note: In this case, you could do picking by simply calling theSoHandleEventAction
'sgetPickedPoint()
method, which applies anSoRayPickAction
internally. However it may be necessary to useSoRayPickAction
directly in order to set specific options.class MouseBtnCB extends SoEventCallbackCB { @Override public void invoke( SoEventCallback node ) { SoEvent evt = node.getEvent(); // If button 1 was pressed if (SoMouseButtonEvent.isButtonPressEvent( evt, SoMouseButtonEvent.Buttons.BUTTON1 )) { SoHandleEventAction action = node.getAction(); SoRayPickAction rayPick = new SoRayPickAction( action.getViewportRegion() ); rayPick.setPoint( evt.getPosition() ); rayPick.setRadius( 10 ); // Optional: Use larger pick radius rayPick.apply( action.getPickRoot() ); SoPickedPoint pickedPt = rayPick.getPickedPoint(); if (pickedPt != null) { SoPath pickedPath = pickedPt.getPath(); SoNode pickedNode = pickedPath.full.getTail(); } } } } - See Also:
SoPickedPoint SoPickedPointList
,SoPickStyle
- The shape is compatible with GPU picking.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
SoRayPickAction.PickingModes
-
Nested classes/interfaces inherited from class com.openinventor.inventor.actions.SoAction
SoAction.AppliedCodes, SoAction.DistribModes, SoAction.PathCodes, SoAction.PathIndices
-
Nested classes/interfaces inherited from class com.openinventor.inventor.Inventor
Inventor.ConstructorCommand
-
-
Field Summary
-
Fields inherited from class com.openinventor.inventor.Inventor
VERBOSE_LEVEL, ZeroHandle
-
-
Constructor Summary
Constructors Constructor Description SoRayPickAction(SbViewportRegion viewportRegion)
Constructor takes viewport region to use for picking.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description SoPickedPoint
addIntersection(SbVec3f objectSpacePoint)
Adds anSoPickedPoint
instance representing the given object space point to the current list and returns it.SoPickedPoint
addIntersection(SoPickedPoint pp)
void
clearPickedPointList()
Deprecated.As of Open Inventor 9600.void
computeWorldSpaceRay()
void
enableConicPickVolume(boolean flag)
Controls the pick volume shape for picking withsetRay()
.static void
enableElement(java.lang.Class<? extends Inventor> t, int stkIndex)
void
enableNormalsGeneration(boolean enable)
Enables generation of normal vectors for picked points.void
enableRadiusForTriangles(boolean flag)
Enable radius for triangle-based shape.void
enableTexCoordsGeneration(boolean enable)
Enables generation of texture coordinates for picked points.static void
enableTriangleCulling(boolean flag)
Enables culling of triangles relative to the ray frustum.SbLine
getLine()
SbVec2f
getNormalizedPoint()
Gets the viewport point in normalized coordinates [0..1] (returns the last value passed tosetNormalizedPoint
).SoPickedPoint
getPickedPoint()
Calls getPickedPoint((int)0).SoPickedPoint
getPickedPoint(int index)
Returns the indexed picked point from the list.java.util.Vector<SoPickedPoint>
getPickedPointList()
Returns list of picked points.int
getPickedPointsListLength()
SoRayPickAction.PickingModes
getPickingMode()
Returns thePickingMode
used for the ray pick action.SbVec2s
getPoint()
Gets the viewport point in pixels (returns the last value passed tosetPoint
).SbVec2f
getPointFloat()
Float version ofgetPoint()
.float
getRadius()
Gets the radius (in pixels) around the point.static SoCamera.StereoModes
getStereoMode()
Returns the view used to perform pick when stereo is active.SoPickedPoint
getUnsortedPickedPoint(int i)
SbViewVolume
getViewVolume()
boolean
hasWorldSpaceRay()
boolean
intersect(SbBox3f box)
Calls intersect(box, true).boolean
intersect(SbBox3f box, boolean useFullViewVolume)
Bounding box: just return whether the ray intersects it.boolean
intersect(SbVec3f point)
SbVec3f
intersect(SbVec3f v0, SbVec3f v1)
boolean
intersect(SbXfBox3f box)
Calls intersect(box, true).boolean
intersect(SbXfBox3f box, boolean useFullViewVolume)
Bounding box: just return whether the ray intersects it.boolean
isBetweenPlanes(SbVec3f intersection)
boolean
isConicPickVolume()
Returns true if the picking volume is a conic shape (not a frustum).boolean
isNormalsGenerationEnabled()
Returns whether generation of normal vectors is enabled for picked points.boolean
isPickAll()
Returns whether the action will return all objects intersected or just the closest one.boolean
isRadiusEnableForTriangles()
Returns whether the pick radius specified bysetRadius
is taken into account for picking on triangle-based shapes.boolean
isTexCoordsGenerationEnabled()
Returns whether texture coordinate generation is enabled for picked points.static boolean
isTriangleCulling()
Returns whether triangle culling is enabled.void
setNormalizedPoint(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.void
setObjectSpace()
void
setObjectSpace(SbMatrix matrix)
void
setPickAll(boolean flag)
Sets whether the action will return all objects intersected or just the closest one.void
setPickingMode(SoRayPickAction.PickingModes pickingMode)
Sets the picking mode.void
setPoint(SbVec2f viewportPoint)
Float version ofsetPoint
.void
setPoint(SbVec2s viewportPoint)
Sets the viewport point through which the ray passes, starting at the camera position.void
setRadius(float radius)
Sets the radius around the point.void
setRay(float fovy, SbVec3f start, SbVec3f direction)
Calls setRay(fovy, start, direction, (float)-1.0, (float)-1.0).void
setRay(float fovy, SbVec3f start, SbVec3f direction, float nearDistance)
Calls setRay(fovy, start, direction, nearDistance, (float)-1.0).void
setRay(float fovy, SbVec3f start, SbVec3f direction, float nearDistance, float farDistance)
Sets a world-space ray along which to pick in the the same way as the other version ofsetRay()
, but allows you to set a view angle value.void
setRay(SbVec3f start, SbVec3f direction)
Calls setRay(start, direction, (float)-1.0, (float)-1.0).void
setRay(SbVec3f start, SbVec3f direction, float nearDistance)
Calls setRay(start, direction, nearDistance, (float)-1.0).void
setRay(SbVec3f start, SbVec3f direction, float nearDistance, float farDistance)
Sets a world-space ray along which to pick.static void
setStereoMode(SoCamera.StereoModes stereoMode)
Tells ray pick action in which view the pick occurs.-
Methods inherited from class com.openinventor.inventor.actions.SoPickAction
enableCulling, getViewportRegion, isCullingEnabled, setViewportRegion
-
Methods inherited from class com.openinventor.inventor.actions.SoAction
apply, apply, clearApplyResult, forwardTraversal, forwardTraversal, getContinueActionInBranchFlag, getCurPath, getDistribMode, getNodeAppliedTo, getOriginalPathListAppliedTo, getPathAppliedTo, getPathCode, getPathListAppliedTo, getPipeId, getSceneManager, getState, getWhatAppliedTo, hasTerminated, invalidateState, isBeingApplied, isLastPathListAppliedTo, isUsingAlternateRep, nullAction, postDelayedTraversal, preDelayedTraversal, resetContinueActionInBranchFlag, setPipeId, setSceneManager, setUpState, stopActionInBranch, traverse, useAlternateRep
-
Methods inherited from class com.openinventor.inventor.Inventor
dispose, getNativeResourceHandle
-
-
-
-
Constructor Detail
-
SoRayPickAction
public SoRayPickAction(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.
-
-
Method Detail
-
getPickedPoint
public SoPickedPoint getPickedPoint()
Calls getPickedPoint((int)0).
-
intersect
public boolean intersect(SbBox3f box)
Calls intersect(box, true).
-
intersect
public boolean intersect(SbXfBox3f box)
Calls intersect(box, true).
-
setRay
public void setRay(float fovy, SbVec3f start, SbVec3f direction, float nearDistance)
Calls setRay(fovy, start, direction, nearDistance, (float)-1.0).
-
setRay
public void setRay(SbVec3f start, SbVec3f direction)
Calls setRay(start, direction, (float)-1.0, (float)-1.0).
-
setRay
public void setRay(float fovy, SbVec3f start, SbVec3f direction)
Calls setRay(fovy, start, direction, (float)-1.0, (float)-1.0).
-
setRay
public void setRay(SbVec3f start, SbVec3f direction, float nearDistance)
Calls setRay(start, direction, nearDistance, (float)-1.0).
-
isConicPickVolume
public boolean isConicPickVolume()
Returns true if the picking volume is a conic shape (not a frustum).
-
setNormalizedPoint
public void setNormalizedPoint(SbVec2f normPoint)
-
getPointFloat
public SbVec2f getPointFloat()
Float version ofgetPoint()
. It can be used when a desktop is magnified on a wall of screens using ScaleViz with a tracker device calibrated for this wall.
-
getPoint
public SbVec2s getPoint()
Gets the viewport point in pixels (returns the last value passed tosetPoint
).
-
setPoint
public void setPoint(SbVec2s viewportPoint)
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
orsetRay
. Whichever method you call last is the one that takes effect.
-
getPickingMode
public SoRayPickAction.PickingModes getPickingMode()
Returns thePickingMode
used for the ray pick action.
-
setPoint
public void setPoint(SbVec2f viewportPoint)
Float version ofsetPoint
. 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
orsetRay
. Whichever method you call last is the one that takes effect.
-
enableConicPickVolume
public void enableConicPickVolume(boolean flag)
Controls the pick volume shape for picking withsetRay()
. 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 tosetPoint()
, but this mode is slightly more costly than frustum picking.
-
setPickingMode
public void setPickingMode(SoRayPickAction.PickingModes pickingMode)
Sets the picking mode. . Default value is PickingMode.DEFAULT
-
enableElement
public static void enableElement(java.lang.Class<? extends Inventor> t, int stkIndex)
-
setStereoMode
public static void setStereoMode(SoCamera.StereoModes stereoMode)
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.
-
getStereoMode
public static SoCamera.StereoModes getStereoMode()
Returns the view used to perform pick when stereo is active.
-
isTriangleCulling
public static boolean isTriangleCulling()
Returns whether triangle culling is enabled.
-
enableTriangleCulling
public static void enableTriangleCulling(boolean flag)
Enables culling of triangles relative to the ray frustum. Enabling culling improves performance for shapes containing a large number of triangles. Default is false.
-
setObjectSpace
public void setObjectSpace()
-
setObjectSpace
public void setObjectSpace(SbMatrix matrix)
-
computeWorldSpaceRay
public void computeWorldSpaceRay()
-
hasWorldSpaceRay
public boolean hasWorldSpaceRay()
-
addIntersection
public SoPickedPoint addIntersection(SbVec3f objectSpacePoint)
Adds anSoPickedPoint
instance representing the given object space point to the current list and returns it. If pickAll is true, this inserts the instance in correct sorted order. If it is false, it replaces the one instance in the list only if the new one is closer; if the new one is farther away, no instance is created and NULL is returned, meaning that no more work has to be done to set up theSoPickedPoint
.
-
clearPickedPointList
@Deprecated public void clearPickedPointList()
Deprecated.As of Open Inventor 9600. Use clearApplyResult() methodClears 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).Warning Deprecated since Open Inventor 9600. Use clearApplyResult() method
-
getPickedPoint
public SoPickedPoint getPickedPoint(int index)
Returns the indexed picked point from the list. Returns NULL if index is larger than the number of picked points.
-
isRadiusEnableForTriangles
public boolean isRadiusEnableForTriangles()
Returns whether the pick radius specified bysetRadius
is taken into account for picking on triangle-based shapes.
-
isBetweenPlanes
public boolean isBetweenPlanes(SbVec3f intersection)
-
enableRadiusForTriangles
public void enableRadiusForTriangles(boolean flag)
Enable radius for triangle-based shape. If true, the radius of the ray specified bysetRadius
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.
-
setRay
public void setRay(float fovy, SbVec3f start, SbVec3f direction, float nearDistance, float farDistance)
Sets a world-space ray along which to pick in the the same way as the other version ofsetRay()
, 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 inSoCamera
. 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 radiussetRadius
ifenableConicPickVolume
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.
-
isPickAll
public boolean isPickAll()
Returns whether the action will return all objects intersected or just the closest one.
-
addIntersection
public SoPickedPoint addIntersection(SoPickedPoint pp)
-
getPickedPointList
public java.util.Vector<SoPickedPoint> getPickedPointList()
Returns list of picked points. This results in a copy of the picked point list and a copy of everySoPickedPoint
object in the list.
-
getPickedPointsListLength
public int getPickedPointsListLength()
-
setPickAll
public void setPickAll(boolean flag)
Sets whether the action will return all objects intersected or just the closest one. Default is false (only closest intersection).
-
getUnsortedPickedPoint
public SoPickedPoint getUnsortedPickedPoint(int i)
-
setRay
public void setRay(SbVec3f start, SbVec3f direction, float nearDistance, float farDistance)
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 inSoCamera
. 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 radiussetRadius
ifenableConicPickVolume
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.
-
intersect
public boolean intersect(SbVec3f point)
-
isNormalsGenerationEnabled
public boolean isNormalsGenerationEnabled()
Returns whether generation of normal vectors is enabled for picked points. SeeenableNormalsGeneration()
.
-
getNormalizedPoint
public SbVec2f getNormalizedPoint()
Gets the viewport point in normalized coordinates [0..1] (returns the last value passed tosetNormalizedPoint
). 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).
-
setRadius
public void setRadius(float radius)
Sets the radius around the point. The radius is defined in pixels when defining a ray using thesetPoint
orsetNormalizedPoint
method, and is defined in world coordinates, when the ray is defined using thesetRay
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.
-
getRadius
public float getRadius()
Gets the radius (in pixels) around the point.
-
intersect
public boolean intersect(SbBox3f box, boolean useFullViewVolume)
Bounding box: just return whether the ray intersects it. If useFullViewVolume is true, it intersects the picking view volume with the box. Otherwise, it uses just the picking ray, which is faster.
-
getViewVolume
public SbViewVolume getViewVolume()
-
enableTexCoordsGeneration
public void enableTexCoordsGeneration(boolean 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).
-
getLine
public SbLine getLine()
-
isTexCoordsGenerationEnabled
public boolean isTexCoordsGenerationEnabled()
Returns whether texture coordinate generation is enabled for picked points. SeeenableTexCoordsGeneration()
.
-
intersect
public boolean intersect(SbXfBox3f box, boolean useFullViewVolume)
Bounding box: just return whether the ray intersects it. If useFullViewVolume is true, it intersects the picking view volume with the box. Otherwise, it uses just the picking ray, which is faster.
-
enableNormalsGeneration
public void enableNormalsGeneration(boolean enable)
Enables generation of normal vectors for picked points. Default is true.
-
-