v2.0.0
Loading...
Searching...
No Matches
RayPicker Class Reference

Ray casting and intersection testing. More...

#include <raypicker.h>

Static Public Member Functions

static bool unproject (const QPoint &screenPos, const QRect &paneRect, const QMatrix4x4 &pvm, QVector3D &rayOrigin, QVector3D &rayDir)
static PickResult pick (const QVector3D &rayOrigin, const QVector3D &rayDir, const SubView &subView, const QMap< QString, std::shared_ptr< BrainSurface > > &surfaces, const QMap< const QStandardItem *, std::shared_ptr< BrainSurface > > &itemSurfaceMap, const QMap< const QStandardItem *, std::shared_ptr< DipoleObject > > &itemDipoleMap)
static QString buildLabel (const PickResult &result, const QMap< const QStandardItem *, std::shared_ptr< BrainSurface > > &itemSurfaceMap, const QMap< QString, std::shared_ptr< BrainSurface > > &surfaces)

Detailed Description

Ray casting and intersection testing.

Stateless ray-picking utility.

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

Definition at line 100 of file raypicker.h.

Member Function Documentation

◆ buildLabel()

QString RayPicker::buildLabel ( const PickResult & result,
const QMap< const QStandardItem *, std::shared_ptr< BrainSurface > > & itemSurfaceMap,
const QMap< QString, std::shared_ptr< BrainSurface > > & surfaces )
static

Build a display label from a PickResult.

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

Parameters
[in]resultPickResult from pick().
[in]itemSurfaceMapMap for reverse item → surface lookup.
[in]surfacesSurface map for key-based lookup.
Returns
Display label string.

Definition at line 174 of file raypicker.cpp.

◆ pick()

PickResult RayPicker::pick ( const QVector3D & rayOrigin,
const QVector3D & rayDir,
const SubView & subView,
const QMap< QString, std::shared_ptr< BrainSurface > > & surfaces,
const QMap< const QStandardItem *, std::shared_ptr< BrainSurface > > & itemSurfaceMap,
const QMap< const QStandardItem *, std::shared_ptr< DipoleObject > > & itemDipoleMap )
static

Cast a ray against all surfaces in the scene.

Parameters
[in]rayOriginWorld-space ray origin.
[in]rayDirWorld-space ray direction (normalised).
[in]subViewActive SubView (for visibility / surface type filtering).
[in]surfacesMap of surface key → BrainSurface.
[in]itemSurfaceMapMap of tree item → BrainSurface (for reverse lookup).
[in]itemDipoleMapMap of tree item → DipoleObject.
Returns
PickResult for the closest hit.

Definition at line 85 of file raypicker.cpp.

◆ unproject()

bool RayPicker::unproject ( const QPoint & screenPos,
const QRect & paneRect,
const QMatrix4x4 & pvm,
QVector3D & rayOrigin,
QVector3D & rayDir )
static

Unproject a screen position to a world-space ray.

Parameters
[in]screenPos2D cursor position (widget coords).
[in]paneRectRectangle of the active viewport pane.
[in]pvmCombined projection × view × model matrix.
[out]rayOriginRay origin (world space).
[out]rayDirRay direction (normalised, world space).
Returns
True if the unproject succeeded.

Definition at line 52 of file raypicker.cpp.


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