Easy3D 2.5.3
ManipulatedCameraFrame Class Reference

A manipulated frame with camera specific mouse bindings. More...

#include <easy3d/renderer/manipulated_camera_frame.h>

Inheritance diagram for ManipulatedCameraFrame:
ManipulatedFrame Frame

Public Member Functions

 ~ManipulatedCameraFrame () override=default
 
 ManipulatedCameraFrame (const ManipulatedCameraFrame &mcf)
 
ManipulatedCameraFrameoperator= (const ManipulatedCameraFrame &mcf)
 
Pivot point
vec3 pivotPoint () const
 
void setPivotPoint (const vec3 &point)
 
Camera manipulation
bool zoomsOnPivotPoint () const
 
void setZoomsOnPivotPoint (bool enabled)
 
- Public Member Functions inherited from ManipulatedFrame
 ManipulatedFrame ()
 
 ~ManipulatedFrame () override=default
 
 ManipulatedFrame (const ManipulatedFrame &mf)
 
ManipulatedFrameoperator= (const ManipulatedFrame &mf)
 
void setRotationSensitivity (float sensitivity)
 
void setTranslationSensitivity (float sensitivity)
 
void setWheelSensitivity (float sensitivity)
 
void setZoomSensitivity (float sensitivity)
 
float rotationSensitivity () const
 
float translationSensitivity () const
 
float zoomSensitivity () const
 
float wheelSensitivity () const
 
virtual void action_start ()
 
virtual void action_end ()
 
- Public Member Functions inherited from Frame
 Frame ()
 
virtual ~Frame ()
 
 Frame (const Frame &frame)
 
Frameoperator= (const Frame &frame)
 
 Frame (const vec3 &position, const quat &orientation)
 
void setPosition (const vec3 &position)
 
void setPositionWithConstraint (vec3 &position)
 
void setOrientation (const quat &orientation)
 
void setOrientationWithConstraint (quat &orientation)
 
void setPositionAndOrientation (const vec3 &position, const quat &orientation)
 
void setPositionAndOrientationWithConstraint (vec3 &position, quat &orientation)
 
vec3 position () const
 
quat orientation () const
 
void setTranslation (const vec3 &translation)
 
void setTranslationWithConstraint (vec3 &translation)
 
void setRotation (const quat &rotation)
 
void setRotationWithConstraint (quat &rotation)
 
void setTranslationAndRotation (const vec3 &translation, const quat &rotation)
 
void setTranslationAndRotationWithConstraint (vec3 &translation, quat &rotation)
 
vec3 translation () const
 
quat rotation () const
 
const FramereferenceFrame () const
 
void setReferenceFrame (const Frame *const refFrame)
 
bool settingAsReferenceFrameWillCreateALoop (const Frame *const frame)
 
void translate (vec3 &t)
 
void translate (const vec3 &t)
 
void rotate (quat &q)
 
void rotate (const quat &q)
 
void rotateAroundPoint (quat &rotation, const vec3 &point)
 
void rotateAroundPoint (const quat &rotation, const vec3 &point)
 
void alignWithFrame (const Frame *const frame, bool move=false, float threshold=0.0f)
 
void projectOnLine (const vec3 &origin, const vec3 &direction)
 
vec3 coordinatesOf (const vec3 &src) const
 
vec3 inverseCoordinatesOf (const vec3 &src) const
 
vec3 localCoordinatesOf (const vec3 &src) const
 
vec3 localInverseCoordinatesOf (const vec3 &src) const
 
vec3 coordinatesOfIn (const vec3 &src, const Frame *const in) const
 
vec3 coordinatesOfFrom (const vec3 &src, const Frame *const from) const
 
vec3 transformOf (const vec3 &src) const
 
vec3 inverseTransformOf (const vec3 &src) const
 
vec3 localTransformOf (const vec3 &src) const
 
vec3 localInverseTransformOf (const vec3 &src) const
 
vec3 transformOfIn (const vec3 &src, const Frame *const in) const
 
vec3 transformOfFrom (const vec3 &src, const Frame *const from) const
 
Constraintconstraint () const
 
void setConstraint (Constraint *const constraint)
 
mat4 matrix () const
 
mat4 worldMatrix () const
 
void setFromMatrix (const mat4 &m)
 
Frame inverse () const
 
Frame worldInverse () const
 

Frame manipulation

class Camera
 
class Viewer
 
void action_rotate (int mouse_x, int mouse_y, int mouse_dx, int mouse_dy, Camera *camera, ScreenAxis axis) override
 
void action_translate (int mouse_x, int mouse_y, int mouse_dx, int mouse_dy, Camera *camera, ScreenAxis axis) override
 
void action_zoom (int dy_wheel, Camera *camera) override
 
virtual void action_turn (float angle_radian, Camera *camera)
 

Additional Inherited Members

- Public Types inherited from ManipulatedFrame
enum  ScreenAxis { NONE , HORIZONTAL , VERTICAL , ORTHOGONAL }
 
- Public Attributes inherited from Frame
Signal modified
 

Detailed Description

A manipulated frame with camera specific mouse bindings.

A ManipulatedCameraFrame is a specialization of a ManipulatedFrame, designed to be set as the Camera::frame(). Mouse motions are basically interpreted in a negated way: when the mouse goes to the right, the ManipulatedFrame translation goes to the right, while the ManipulatedCameraFrame has to go to the left, so that the scene seems to move to the right.

A ManipulatedCameraFrame rotates around its pivotPoint(), which corresponds to the associated Camera::pivotPoint().

A ManipulatedCameraFrame can also "fly" in the scene. It basically moves forward, and turns according to the mouse motion. See flySpeed(), sceneUpVector() and the QGLViewer::MOVE_FORWARD and QGLViewer::MOVE_BACKWARD QGLViewer::MouseAction.

See the mouse page for a description of the possible actions that can be performed using the mouse and their bindings.

Constructor & Destructor Documentation

◆ ~ManipulatedCameraFrame()

~ManipulatedCameraFrame ( )
overridedefault

Virtual destructor. Empty.

◆ ManipulatedCameraFrame()

Copy constructor. Performs a deep copy of all members using operator=().

Member Function Documentation

◆ action_rotate()

void action_rotate ( int  x,
int  y,
int  dx,
int  dy,
Camera camera,
ScreenAxis  axis 
)
overridevirtual

Modifies the ManipulatedFrame according to the mouse motion.

Actual behavior depends on mouse bindings. See the QGLViewer::MouseAction enum and the QGLViewer mouse page for details.

The camera is used to fit the mouse motion with the display parameters (see Camera::screenWidth(), Camera::screenHeight(), Camera::fieldOfView()).

Emits the manipulated() signal.

Reimplemented from ManipulatedFrame.

Examples
Tutorial_203_Viewer_wxWidgets, and Tutorial_204_Viewer_Qt.

◆ action_translate()

void action_translate ( int  mouse_x,
int  mouse_y,
int  mouse_dx,
int  mouse_dy,
Camera camera,
ScreenAxis  axis 
)
overridevirtual

◆ action_zoom()

void action_zoom ( int  dy_wheel,
Camera camera 
)
overridevirtual

◆ operator=()

ManipulatedCameraFrame & operator= ( const ManipulatedCameraFrame mcf)

Equal operator. Calls ManipulatedFrame::operator=() and then copy attributes.

◆ pivotPoint()

vec3 pivotPoint ( ) const
inline

Returns the point the ManipulatedCameraFrame pivot point, around which the camera rotates.

It is defined in the world coordinate system. Default value is (0,0,0).

When the ManipulatedCameraFrame is associated to a Camera, Camera::pivotPoint() also returns this value. This point can interactively be changed using the mouse (see Camera::setPivotPointFromPixel() and QGLViewer::RAP_FROM_PIXEL and QGLViewer::RAP_IS_CENTER in the mouse page).

◆ setPivotPoint()

void setPivotPoint ( const vec3 point)
inline

Sets the pivotPoint(), defined in the world coordinate system.

◆ setZoomsOnPivotPoint()

void setZoomsOnPivotPoint ( bool  enabled)
inline

Sets the value of zoomsOnPivotPoint(). Default value is false.

◆ zoomsOnPivotPoint()

bool zoomsOnPivotPoint ( ) const
inline

Returns whether or not the QGLViewer::ZOOM action zooms on the pivot point.

When set to false (default), a zoom action will move the camera along its Camera::viewDirection(), i.e. back and forth along a direction perpendicular to the projection screen.

setZoomsOnPivotPoint() to true will move the camera along an axis defined by the Camera::pivotPoint() and its current position instead. As a result, the projected position of the pivot point on screen will stay the same during a zoom.


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