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

#include <ScaleHandle.h>

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

Public Member Functions

 ScaleHandle (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::mat4 getModelMatrix () const override
 Gets the model transformation matrix for rendering this handle.
 
glm::vec3 getAxisDir () const override
 Gets the axis direction this handle operates along/around.
 
- 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 5 of file ScaleHandle.h.

Constructor & Destructor Documentation

◆ ScaleHandle()

ScaleHandle::ScaleHandle ( SceneObject tgt,
Axis  ax 
)

Definition at line 5 of file ScaleHandle.cpp.

Member Function Documentation

◆ getAxisDir()

glm::vec3 ScaleHandle::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 12 of file ScaleHandle.h.

Here is the call graph for this function:

◆ getModelMatrix()

glm::mat4 ScaleHandle::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 24 of file ScaleHandle.cpp.

Here is the call graph for this function:

◆ onDrag()

void ScaleHandle::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 7 of file ScaleHandle.cpp.

Here is the call graph for this function:

◆ setDragState()

void ScaleHandle::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 19 of file ScaleHandle.cpp.

Here is the call graph for this function:

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