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

#include <TranslateHandle.h>

Inheritance diagram for TranslateHandle:
[legend]
Collaboration diagram for TranslateHandle:
[legend]

Public Member Functions

 TranslateHandle (SceneObject *tgt, Axis ax)
 
void onDrag (const Math::Ray &ray) override
 Handles continuous dragging motion.
 
void setDragState (glm::vec3 initHitPos) override
 Initializes the drag operation state.
 
glm::vec3 getAxisDir () const override
 Gets the axis direction this handle operates along/around.
 
glm::mat4 getModelMatrix () const override
 Gets the model transformation matrix for rendering this handle.
 
- Public Member Functions inherited from IHandle
virtual ~IHandle ()=default
 Virtual destructor for proper cleanup of derived classes.
 

Additional Inherited Members

- Protected Member Functions inherited from IHandle
 IHandle ()=default
 Protected constructor to enforce interface-only usage.
 
- Static Protected Member Functions inherited from IHandle
static glm::mat4 rotateFromYToAxis (Axis axis)
 Computes rotation matrix to align mesh from +Y to target axis.
 

Detailed Description

Definition at line 7 of file TranslateHandle.h.

Constructor & Destructor Documentation

◆ TranslateHandle()

TranslateHandle::TranslateHandle ( SceneObject tgt,
Axis  ax 
)

Definition at line 8 of file TranslateHandle.cpp.

Member Function Documentation

◆ getAxisDir()

glm::vec3 TranslateHandle::getAxisDir ( ) const
inlineoverridevirtual

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.

Implements IHandle.

Definition at line 13 of file TranslateHandle.h.

Here is the call graph for this function:

◆ getModelMatrix()

glm::mat4 TranslateHandle::getModelMatrix ( ) const
overridevirtual

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.

Implements IHandle.

Definition at line 10 of file TranslateHandle.cpp.

Here is the call graph for this function:

◆ onDrag()

void TranslateHandle::onDrag ( const Math::Ray ray)
overridevirtual

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()

Implements IHandle.

Definition at line 18 of file TranslateHandle.cpp.

Here is the call graph for this function:

◆ setDragState()

void TranslateHandle::setDragState ( glm::vec3  initHitPos)
overridevirtual

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()

Implements IHandle.

Definition at line 29 of file TranslateHandle.cpp.

Here is the call graph for this function:

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