Physics Simulation & Visualization Tool 0.1
A C++ physics simulation engine with real-time 3D visualization
Loading...
Searching...
No Matches
IHandle Interface Referenceabstract

Abstract interface for gizmo manipulation handles. More...

#include <IHandle.h>

Inheritance diagram for IHandle:
[legend]

Public Member Functions

virtual ~IHandle ()=default
 Virtual destructor for proper cleanup of derived classes.
 
virtual void onDrag (const Math::Ray &ray)=0
 Handles continuous dragging motion.
 
virtual void setDragState (glm::vec3 initHitPos)=0
 Initializes the drag operation state.
 
virtual glm::vec3 getAxisDir () const =0
 Gets the axis direction this handle operates along/around.
 
virtual glm::mat4 getModelMatrix () const =0
 Gets the model transformation matrix for rendering this handle.
 

Protected Member Functions

 IHandle ()=default
 Protected constructor to enforce interface-only usage.
 

Static Protected Member Functions

static glm::mat4 rotateFromYToAxis (Axis axis)
 Computes rotation matrix to align mesh from +Y to target axis.
 

Detailed Description

Abstract interface for gizmo manipulation handles.

IHandle defines the behavior contract for interactive manipulation tools (translation, rotation, scale handles) without dictating how they are rendered.

Key design decisions:

  • Does NOT inherit from IDrawable - rendering is managed by the owning Gizmo
  • Handles are purely behavioral - they respond to drag operations
  • Each handle operates along/around a specific axis
See also
Gizmo
TranslateHandle
RotateHandle
ScaleHandle

Definition at line 47 of file IHandle.h.

Constructor & Destructor Documentation

◆ ~IHandle()

virtual IHandle::~IHandle ( )
virtualdefault

Virtual destructor for proper cleanup of derived classes.

◆ IHandle()

IHandle::IHandle ( )
protecteddefault

Protected constructor to enforce interface-only usage.

Member Function Documentation

◆ getAxisDir()

virtual glm::vec3 IHandle::getAxisDir ( ) const
pure virtual

Gets the axis direction this handle operates along/around.

Returns
Unit vector representing the handle's axis direction.
Note
This is used for rendering (color coding) and for identifying which handle the user is interacting with.

Implemented in RotateHandle, ScaleHandle, and TranslateHandle.

◆ getModelMatrix()

virtual glm::mat4 IHandle::getModelMatrix ( ) const
pure virtual

Gets the model transformation matrix for rendering this handle.

The model matrix encodes:

  • Position: Target object's position
  • Rotation: Aligned to the handle's axis
  • Scale: Handle's visual size
Returns
The 4x4 model transformation matrix.
Note
This is used by Gizmo for instanced rendering of all handles.

Implemented in RotateHandle, ScaleHandle, and TranslateHandle.

◆ onDrag()

virtual void IHandle::onDrag ( const Math::Ray ray)
pure virtual

Handles continuous dragging motion.

Called every frame while the handle is being dragged. Implementations should:

  • Project the ray onto the handle's constraint space (axis/plane)
  • Compute the transformation delta since drag started
  • Apply the transformation to the target object
Parameters
rayThe current mouse ray in world space.
Note
This is called after setDragState() has initialized the drag.
See also
setDragState()

Implemented in RotateHandle, ScaleHandle, and TranslateHandle.

Here is the caller graph for this function:

◆ rotateFromYToAxis()

static glm::mat4 IHandle::rotateFromYToAxis ( Axis  axis)
inlinestaticprotected

Computes rotation matrix to align mesh from +Y to target axis.

Handle meshes are authored pointing along +Y. This helper rotates them to point along X, Y, or Z as needed.

Parameters
axisThe target axis to align to.
Returns
Rotation matrix transforming +Y to the specified axis.
Note
Returns identity if axis is already +Y (within tolerance).

Definition at line 127 of file IHandle.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setDragState()

virtual void IHandle::setDragState ( glm::vec3  initHitPos)
pure virtual

Initializes the drag operation state.

Called once when the user begins dragging this handle. Implementations should capture:

  • The initial hit position on the handle
  • The target object's current transformation
  • Any other state needed to compute relative deltas during onDrag()
Parameters
initHitPosThe world-space position where the ray first hit the handle.
See also
onDrag()

Implemented in RotateHandle, ScaleHandle, and TranslateHandle.

Here is the caller graph for this function:

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