SORAYPICKACTION(3iv)
π¦ SoRayPickAction(3IV) π¦
okay bestie, sit down, hydrate, because today we're talking about SoRayPickAction from the 3IV manual, and she is that girl. π
β¨ NAME β¨
SoRayPickAction β she intersects objects with a ray cast into the scene. literally pointing a laser at your 3D world and asking "who's there?" π―β¨
πΈ INHERITS FROM πΈ
SoAction > SoPickAction > SoRayPickAction
the family tree is giving legacy royalty, she's the third generation and she ate π
π SYNOPSIS π
#include <Inventor/actions/SoRayPickAction.h>
Methods from class SoRayPickAction:
SoRayPickAction(const SbViewportRegion
&viewportRegion)
void setPoint(const SbVec2s &viewportPoint)
void setNormalizedPoint(const SbVec2f &normPoint)
void setRadius(float radiusInPixels)
void setRay(const SbVec3f &start, const SbVec3f
&direction, float nearDistance = -1.0,
float farDistance = -1.0)
void setPickAll(SbBool flag)
SbBool isPickAll() const
const SoPickedPointList & getPickedPointList() const
SoPickedPoint * getPickedPoint(int index = 0) const
Methods from class SoPickAction:
void setViewportRegion(const SbViewportRegion
&newRegion)
const SbViewportRegion & getViewportRegion() const
Methods from class SoAction:
virtual void apply(SoNode *node)
virtual void apply(SoPath *path)
virtual void apply(const SoPathList &pathList, SbBool obeysRules =
FALSE)
static SoType getClassTypeId()
virtual SoType getTypeId()
virtual SbBool isOfType(SoType type)
virtual void invalidateState()
π DESCRIPTION π
so what does she actually do? This class performs picking by casting a ray into a scene and running intersection tests with each object. no cap. The ray gets extended into a cone or a cylinder β depends on the camera type β for intersection with points and lines. And every single intersection that comes back is returned as an SoPickedPoint instance. π«Ά
The picking ray can be specified in two ways, bestie: either as a ray from the camera location through a particular viewport pixel, or as a world-space ray. In the first case (the camera-through-a-pixel one), a valid camera must be encountered during traversal of the graph to figure out where that ray actually lives in world space. no camera, no ray, no vibes. π
Callers can make the action compute all the intersections along the ray β sorted closest to farthest, queen behaviour β by setting the pickAll flag to TRUE. By default though, the action only computes the closest intersection, because sometimes you just want the one. Either way, the intersections come back in an SoPickedPointList. Each intersection can be examined by accessing the appropriate SoPickedPoint in the list, and the SoPickedPoint class has methods to get the intersection point, normal, and other info. iconic. β¨
π METHODS π
SoRayPickAction(const SbViewportRegion
&viewportRegion)
Constructor takes the viewport region to use for picking. And like β even though the picking operation may not involve a window per se, some nodes genuinely need this info to determine their size and placement. so don't skip it. π
void setPoint(const SbVec2s &viewportPoint)β Sets the viewport-space point that the ray passes through, starting at the camera's viewpoint. Viewport coordinates range from(0,0)at the lower left all the way to(width-1,height-1)at the upper right. π
void setNormalizedPoint(const SbVec2f &normPoint)β Same idea but normalized, bestie. Sets the viewport point in normalized coordinates, which range from(0,0)at the lower left to(1,1)at the upper right. cute, tidy, decimal. πΈ
void setRadius(float radiusInPixels)β Sets the radius (in pixels) around the point. This gets used when testing the ray against lines and points. By default, the radius is5pixels. For perspective cameras, the ray is extended to be a cone when testing against lines and points. For orthographic cameras, the ray is extended to be a cylinder. And heads up β the radius has no effect for shapes of other types. she's specific like that. π
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. The ray is defined as a world-space starting point plus a direction vector, and the direction vector will be normalized automatically (you don't have to do it, she'll handle it, queen). The last two arguments are the parametric distances between which intersections along the ray must occur. These distances are measured as if the direction vector is unit length β so like, ifnearDistanceis2.0, the intersection must occur past(start + 2*(length of the direction vector))units along the ray. You can use these distances to achieve near and far plane clipping. A negative distance (such as the default values) means disable clipping to that plane. π«Ά
void setPickAll(SbBool flag)SbBool isPickAll() const
Sets/returns whether the action will return all objects intersected or just the closest one. the eternal question: everyone or just the one. π
const SoPickedPointList & getPickedPointList() constβ Returns the list of picked points. the whole roster. π
SoPickedPoint * getPickedPoint(int index = 0) constβ Returns the indexed picked point from the list. default index is0, so she'll hand you the first one if you don't specify. lowkey convenient. β
π SEE ALSO π
SoPickedPoint, SoPickedPointList
go read those next, they're the supporting cast and they're lowkey main characters too. π¦
ngl the whole vibe here is: cast the ray, collect the points, respect the defaults. and remember, if you want all the hits, setPickAll(TRUE) or you're only getting the closest one. periodt. π
and that's the page!! π this was SoRayPickAction(3IV) from the 3IV manual β and yeah, the footer is literally just SoRayPickAction(3IV)() again, same name, no date, no version, zero extra info, she's mysterious like that πβ¨ thanks for reading bestie, go pick some rays, ily π«Ά
π¦ where this page comes from
- debian bookworm: inventor-doc 2.1.5-10+dfsg-2 Β· LGPL-2.0-or-later
- debian trixie: inventor-doc 2.1.6+ds-2 Β· LGPL-2.0-or-later
- ubuntu jammy: inventor-doc 2.1.5-10-24
- ubuntu noble: inventor-doc 2.1.5-10+dfsg-2.1build2 Β· LGPL-2.0-or-later
- ubuntu questing: inventor-doc 2.1.6+ds-2
- ubuntu resolute: inventor-doc 2.1.6.1+ds-1 Β· LGPL-2.0-or-later
- ubuntu stonking: inventor-doc 2.1.6.1+ds-1 Β· LGPL-2.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms