Skip to main content

RayPicker

Namespace: DISP3DLIB  ·  Library: 3D Display Library

#include <disp3D/raypicker.h>

class DISP3DLIB::RayPicker

Stateless ray-picking utility.

Given camera matrices, a screen position, and the scene contents, this class casts a ray and returns a RayHit describing the closest intersection. It has no state of its own — hover tracking is handled by the caller.

Ray casting and intersection testing.


Static Methods​

unproject(screenPos, paneRect, pvm, rayOrigin, rayDir)​

Unproject a screen position to a world-space ray.

Parameters:

  • screenPos : const QPoint & 2D cursor position (widget coords).

  • paneRect : const QRect & Rectangle of the active viewport pane.

  • pvm : const QMatrix4x4 & Combined projection × view × model matrix.

  • rayOrigin : QVector3D & Ray origin (world space).

  • rayDir : QVector3D & Ray direction (normalised, world space).

Returns:

  • bool — True if the unproject succeeded.

pick(rayOrigin, rayDir, subView, surfaces, itemSurfaceMap, itemDipoleMap)​

Cast a ray against all surfaces in the scene.

Parameters:

  • rayOrigin : const QVector3D & World-space ray origin.

  • rayDir : const QVector3D & World-space ray direction (normalised).

  • subView : const SubView & Active SubView (for visibility / surface type filtering).

  • surfaces : const QMap< QString, std::shared_ptr< BrainSurface > > & Map of surface key → BrainSurface.

  • itemSurfaceMap : *const QMap< const QStandardItem , std::shared_ptr< BrainSurface > > & Map of tree item → BrainSurface (for reverse lookup).

  • itemDipoleMap : *const QMap< const QStandardItem , std::shared_ptr< DipoleObject > > & Map of tree item → DipoleObject.

Returns:


buildLabel(result, itemSurfaceMap, surfaces)​

Build a display label from a RayHit.

This examines the surface key, annotation data, and item type to produce a human-readable hover label.

Parameters:

  • result : const RayHit & RayHit from pick().

  • itemSurfaceMap : *const QMap< const QStandardItem , std::shared_ptr< BrainSurface > > & Map for reverse item → surface lookup.

  • surfaces : const QMap< QString, std::shared_ptr< BrainSurface > > & FsSurface map for key-based lookup.

Returns:

  • QString — Display label string.

Authors of this file​