Easy3D 2.5.3
Manipulator Class Reference

A manipulator is for manipulation of an object. More...

#include <easy3d/renderer/manipulator.h>

Public Member Functions

 Manipulator (Model *model=nullptr)
 Constructor. A manipulator can be attached to a model.
 
void reset ()
 Resets the manipulated frame, i.e., no transformation.
 
ManipulatedFrameframe ()
 Returns the manipulated frame.
 
const ManipulatedFrameframe () const
 Returns the manipulated frame.
 
mat4 matrix () const
 
void draw_frame (const Camera *cam) const
 Draws the manipulated frame.
 

Detailed Description

A manipulator is for manipulation of an object.

A manipulator maintains the manipulated frame of an object. The manipulated frame is used to manipulate this object. In this implementation, the origin of the manipulated frame is always at the center of the object.

The following code shows how to use this manipulator:

// create a manipulator and attach it to the model
model->set_manipulator(new Manipulator(model));
// connect the manipulator's signal to the viewer's update function to automatically update rendering.
model->manipulator()->frame()->modified.connect(viewer, static_cast<void (Viewer::*)(void)>(&Viewer::update));
// then in the mouse event, call the following functions:
model->manipulator()->frame()->action_rotate(x, y, dx, dy, camera, axis); // axis = NONE for free rotation
model->manipulator()->frame()->action_translate(x, y, dx, dy, camera, axis); // axis = NONE for free translation
Manipulator(Model *model=nullptr)
Constructor. A manipulator can be attached to a model.
Definition: manipulator.cpp:38
void update() const
Update the display (i.e., repaint).
Definition: viewer.cpp:631
// don't forget to delete the manipulator when the model is deleted
delete model->manipulator();
Examples
Tutorial_405_ObjectManipulation, and Tutorial_406_CollisionDetection.

Member Function Documentation

◆ matrix()

mat4 matrix ( ) const

Returns the transformation introduced by this manipulator.

Note
Rotation is performed around object 'center'. Thus the returned transformation is different from 'frame()->matrix()'. Their relation is: 'matrix() == frame()->matrix() * mat4::translation(-center)'.

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