Easy3D 2.6.1
Loading...
Searching...
No Matches
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 ()
 Default constructor.
 
 ~ManipulatedCameraFrame () override=default
 
 ManipulatedCameraFrame (const ManipulatedCameraFrame &mcf)
 Copy constructor.
 
ManipulatedCameraFrameoperator= (const ManipulatedCameraFrame &mcf)
 Copy assignment operator.
 
Pivot point
vec3 pivotPoint () const
 Returns the point the ManipulatedCameraFrame pivots around, which is the camera's pivot point.
 
void setPivotPoint (const vec3 &point)
 Sets the pivotPoint(), defined in the world coordinate system.
 
Camera manipulation
bool zoomsOnPivotPoint () const
 Returns whether the QGLViewer::ZOOM action zooms on the pivot point.
 
void setZoomsOnPivotPoint (bool enabled)
 Sets the value of zoomsOnPivotPoint().
 
- Public Member Functions inherited from ManipulatedFrame
 ManipulatedFrame ()
 Default constructor.
 
 ~ManipulatedFrame () override=default
 
 ManipulatedFrame (const ManipulatedFrame &mf)
 Copy constructor.
 
ManipulatedFrameoperator= (const ManipulatedFrame &mf)
 Copy assignment operator.
 
void setRotationSensitivity (float sensitivity)
 Sets the rotation sensitivity.
 
void setTranslationSensitivity (float sensitivity)
 Sets the translation sensitivity.
 
void setWheelSensitivity (float sensitivity)
 Sets the wheel sensitivity.
 
void setZoomSensitivity (float sensitivity)
 Sets the zoom sensitivity.
 
float rotationSensitivity () const
 Returns the rotation sensitivity.
 
float translationSensitivity () const
 Returns the translation sensitivity.
 
float zoomSensitivity () const
 Returns the zoom sensitivity.
 
float wheelSensitivity () const
 Returns the wheel sensitivity.
 
virtual void action_start ()
 Initiates the ManipulatedFrame mouse manipulation.
 
virtual void action_end ()
 Stops the ManipulatedFrame mouse manipulation.
 
- Public Member Functions inherited from Frame
 Frame ()
 Default constructor.
 
virtual ~Frame ()
 
 Frame (const Frame &frame)
 Copy constructor.
 
Frameoperator= (const Frame &frame)
 Assignment operator.
 
 Frame (const vec3 &position, const quat &orientation)
 Constructor with position and orientation.
 
void setPosition (const vec3 &position)
 Sets the position of the Frame.
 
void setPositionWithConstraint (vec3 &position)
 Sets the position of the Frame with constraint.
 
void setOrientation (const quat &orientation)
 Sets the orientation of the Frame.
 
void setOrientationWithConstraint (quat &orientation)
 Sets the orientation of the Frame with constraint.
 
void setPositionAndOrientation (const vec3 &position, const quat &orientation)
 Sets the position and orientation of the Frame.
 
void setPositionAndOrientationWithConstraint (vec3 &position, quat &orientation)
 Sets the position and orientation of the Frame with constraint.
 
vec3 position () const
 Returns the position of the Frame.
 
quat orientation () const
 Returns the orientation of the Frame.
 
void setTranslation (const vec3 &translation)
 Sets the translation of the Frame.
 
void setTranslationWithConstraint (vec3 &translation)
 Sets the translation of the Frame with constraint.
 
void setRotation (const quat &rotation)
 Sets the rotation of the Frame.
 
void setRotationWithConstraint (quat &rotation)
 Sets the rotation of the Frame with constraint.
 
void setTranslationAndRotation (const vec3 &translation, const quat &rotation)
 Sets the translation and rotation of the Frame.
 
void setTranslationAndRotationWithConstraint (vec3 &translation, quat &rotation)
 Sets the translation and rotation of the Frame with constraint.
 
vec3 translation () const
 Returns the translation of the Frame.
 
quat rotation () const
 Returns the rotation of the Frame.
 
const FramereferenceFrame () const
 Returns the reference Frame.
 
void setReferenceFrame (const Frame *refFrame)
 Sets the reference Frame.
 
bool settingAsReferenceFrameWillCreateALoop (const Frame *const frame) const
 Checks if setting the reference Frame will create a loop.
 
void translate (vec3 &t)
 Translates the Frame.
 
void translate (const vec3 &t)
 Translates the Frame.
 
void rotate (quat &q)
 Rotates the Frame.
 
void rotate (const quat &q)
 Rotates the Frame.
 
void rotateAroundPoint (quat &rotation, const vec3 &point)
 Rotates the Frame around a point.
 
void rotateAroundPoint (const quat &rotation, const vec3 &point)
 Rotates the Frame around a point.
 
void alignWithFrame (const Frame *const frame, bool move=false, float threshold=0.0f)
 Aligns the Frame with another Frame.
 
void projectOnLine (const vec3 &origin, const vec3 &direction)
 Projects the Frame on a line.
 
vec3 coordinatesOf (const vec3 &src) const
 Transforms a 3D point to the Frame's coordinate system.
 
vec3 inverseCoordinatesOf (const vec3 &src) const
 Transforms a 3D point from the Frame's coordinate system to the world coordinate system.
 
vec3 localCoordinatesOf (const vec3 &src) const
 Transforms a 3D point to the Frame's local coordinate system.
 
vec3 localInverseCoordinatesOf (const vec3 &src) const
 Transforms a 3D point from the Frame's local coordinate system to the world coordinate system.
 
vec3 coordinatesOfIn (const vec3 &src, const Frame *const in) const
 Transforms a 3D point to another Frame's coordinate system.
 
vec3 coordinatesOfFrom (const vec3 &src, const Frame *const from) const
 Transforms a 3D point from another Frame's coordinate system to the Frame's coordinate system.
 
vec3 transformOf (const vec3 &src) const
 Transforms a 3D vector to the Frame's coordinate system.
 
vec3 inverseTransformOf (const vec3 &src) const
 Transforms a 3D vector from the Frame's coordinate system to the world coordinate system.
 
vec3 localTransformOf (const vec3 &src) const
 Transforms a 3D vector to the Frame's local coordinate system.
 
vec3 localInverseTransformOf (const vec3 &src) const
 Transforms a 3D vector from the Frame's local coordinate system to the world coordinate system.
 
vec3 transformOfIn (const vec3 &src, const Frame *const in) const
 Transforms a 3D vector to another Frame's coordinate system.
 
vec3 transformOfFrom (const vec3 &src, const Frame *const from) const
 Transforms a 3D vector from another Frame's coordinate system to the Frame's coordinate system.
 
Constraintconstraint () const
 Returns the current constraint applied to the Frame.
 
void setConstraint (Constraint *const constraint)
 Sets the constraint attached to the Frame.
 
mat4 matrix () const
 Returns the transformation matrix of the Frame.
 
mat4 worldMatrix () const
 Returns the world transformation matrix of the Frame.
 
void setFromMatrix (const mat4 &m)
 Sets the Frame from a transformation matrix.
 
Frame inverse () const
 Returns the inverse of the Frame.
 
Frame worldInverse () const
 Returns the inverse of the Frame's world transformation.
 

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
 Rotates the frame based on mouse movement.
 
void action_translate (int mouse_x, int mouse_y, int mouse_dx, int mouse_dy, Camera *camera, ScreenAxis axis) override
 Translates the frame based on mouse movement.
 
void action_zoom (int dy_wheel, Camera *camera) override
 Zooms the frame based on mouse wheel movement.
 
virtual void action_turn (float angle_radian, Camera *camera)
 Turns the frame around the camera's Y axis.
 

Additional Inherited Members

- Public Types inherited from ManipulatedFrame
enum  ScreenAxis { NONE , HORIZONTAL , VERTICAL , ORTHOGONAL }
 ScreenAxis constrains rotation or translation around/along the axis. More...
 
Signal modified
 Signal emitted when the Frame is 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 interpreted in a way that mimics the movement of the camera in the scene. For example, when the mouse moves to the right, the ManipulatedFrame would translate to the right, but the ManipulatedCameraFrame translates to the left, making the scene appear to move to the right.

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

Constructor & Destructor Documentation

◆ ~ManipulatedCameraFrame()

~ManipulatedCameraFrame ( )
overridedefault

Virtual destructor. Empty.

◆ ManipulatedCameraFrame()

Copy constructor.

Parameters
mcfThe ManipulatedCameraFrame to copy from.

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

Member Function Documentation

◆ action_rotate()

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

Rotates the frame based on mouse movement.

Parameters
mouse_xThe current x position of the mouse.
mouse_yThe current y position of the mouse.
mouse_dxThe change in x position of the mouse.
mouse_dyThe change in y position of the mouse.
cameraThe camera associated with the frame.
axisThe axis of rotation.

Reimplemented from ManipulatedFrame.

◆ action_translate()

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

Translates the frame based on mouse movement.

Parameters
mouse_xThe current x position of the mouse.
mouse_yThe current y position of the mouse.
mouse_dxThe change in x position of the mouse.
mouse_dyThe change in y position of the mouse.
cameraThe camera associated with the frame.
axisThe axis of translation.

Reimplemented from ManipulatedFrame.

◆ action_turn()

void action_turn ( float angle_radian,
Camera * camera )
virtual

Turns the frame around the camera's Y axis.

Parameters
angle_radianThe angle of rotation in radians.
cameraThe camera associated with the frame.

◆ action_zoom()

void action_zoom ( int dy_wheel,
Camera * camera )
overridevirtual

Zooms the frame based on mouse wheel movement.

Parameters
dy_wheelThe change in the mouse wheel position.
cameraThe camera associated with the frame.

Reimplemented from ManipulatedFrame.

◆ operator=()

ManipulatedCameraFrame & operator= ( const ManipulatedCameraFrame & mcf)

Copy assignment operator.

Parameters
mcfThe ManipulatedCameraFrame to assign from.
Returns
A reference to this ManipulatedCameraFrame.

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

◆ pivotPoint()

vec3 pivotPoint ( ) const
inline

Returns the point the ManipulatedCameraFrame pivots around, which is the camera's pivot point.

The pivot point is defined in the world coordinate system. Default value is (0,0,0). When the ManipulatedCameraFrame is associated with a Camera, Camera::pivotPoint() also returns this value. This point can interactively be changed by Camera::setPivotPoint().

Returns
The pivot point.
See also
setPivotPoint()

◆ setPivotPoint()

void setPivotPoint ( const vec3 & point)
inline

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

Parameters
pointThe new pivot point.

◆ setZoomsOnPivotPoint()

void setZoomsOnPivotPoint ( bool enabled)
inline

Sets the value of zoomsOnPivotPoint().

Parameters
enabledWhether zooming on the pivot point is enabled.

◆ zoomsOnPivotPoint()

bool zoomsOnPivotPoint ( ) const
inline

Returns whether 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.

Returns
true if zooming on the pivot point is enabled, false otherwise.

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