Public Member Functions | Protected Member Functions | Private Slots | Private Member Functions | Private Attributes | Friends | List of all members
qglviewer::ManipulatedCameraFrame Class Reference

The ManipulatedCameraFrame class represents a ManipulatedFrame with Camera specific mouse bindings. More...

#include <QGLViewer/manipulatedCameraFrame.h>

Inheritance diagram for qglviewer::ManipulatedCameraFrame:
Inheritance graph
[legend]

Public Member Functions

 ManipulatedCameraFrame ()
 
 ManipulatedCameraFrame (const ManipulatedCameraFrame &mcf)
 
ManipulatedCameraFrameoperator= (const ManipulatedCameraFrame &mcf)
 
virtual ~ManipulatedCameraFrame ()
 
- Public Member Functions inherited from qglviewer::ManipulatedFrame
 ManipulatedFrame ()
 
 ManipulatedFrame (const ManipulatedFrame &mf)
 
ManipulatedFrameoperator= (const ManipulatedFrame &mf)
 
virtual ~ManipulatedFrame ()
 
void setTranslationSensitivity (float sensitivity)
 
void setSpinningSensitivity (float sensitivity)
 
void setWheelSensitivity (float sensitivity)
 
float rotationSensitivity () const
 
float translationSensitivity () const
 
float spinningSensitivity () const
 
float wheelSensitivity () const
 
bool isSpinning () const
 
Quaternion spinningQuaternion () const
 
bool isManipulated () const
 
virtual void checkIfGrabsMouse (int x, int y, const Camera *const camera)
 
- Public Member Functions inherited from qglviewer::Frame
 Frame ()
 
 Frame (const Frame &frame)
 
Frameoperator= (const Frame &frame)
 
virtual ~Frame ()
 
 Frame (const Vec &position, const Quaternion &orientation)
 
void setPosition (const Vec &position)
 
void setPosition (float x, float y, float z)
 
void setPositionWithConstraint (Vec &position)
 
void setOrientation (const Quaternion &orientation)
 
void setOrientation (double q0, double q1, double q2, double q3)
 
void setOrientationWithConstraint (Quaternion &orientation)
 
void setPositionAndOrientation (const Vec &position, const Quaternion &orientation)
 
void setPositionAndOrientationWithConstraint (Vec &position, Quaternion &orientation)
 
Vec position () const
 
Quaternion orientation () const
 
void getPosition (float &x, float &y, float &z) const
 
void getOrientation (double &q0, double &q1, double &q2, double &q3) const
 
void setTranslation (const Vec &translation)
 
void setTranslation (float x, float y, float z)
 
void setTranslationWithConstraint (Vec &translation)
 
void setRotation (const Quaternion &rotation)
 
void setRotation (double q0, double q1, double q2, double q3)
 
void setRotationWithConstraint (Quaternion &rotation)
 
void setTranslationAndRotation (const Vec &translation, const Quaternion &rotation)
 
void setTranslationAndRotationWithConstraint (Vec &translation, Quaternion &rotation)
 
Vec translation () const
 
Quaternion rotation () const
 
void getTranslation (float &x, float &y, float &z) const
 
void getRotation (double &q0, double &q1, double &q2, double &q3) const
 
const FramereferenceFrame () const
 
void setReferenceFrame (const Frame *const refFrame)
 
bool settingAsReferenceFrameWillCreateALoop (const Frame *const frame)
 
void translate (Vec &t)
 
void translate (const Vec &t)
 
void translate (float x, float y, float z)
 
void translate (float &x, float &y, float &z)
 
void rotate (Quaternion &q)
 
void rotate (const Quaternion &q)
 
void rotate (double q0, double q1, double q2, double q3)
 
void rotate (double &q0, double &q1, double &q2, double &q3)
 
void rotateAroundPoint (Quaternion &rotation, const Vec &point)
 
void rotateAroundPoint (const Quaternion &rotation, const Vec &point)
 
void alignWithFrame (const Frame *const frame, bool move=false, float threshold=0.85f)
 
void projectOnLine (const Vec &origin, const Vec &direction)
 
Vec coordinatesOf (const Vec &src) const
 
Vec inverseCoordinatesOf (const Vec &src) const
 
Vec localCoordinatesOf (const Vec &src) const
 
Vec localInverseCoordinatesOf (const Vec &src) const
 
Vec coordinatesOfIn (const Vec &src, const Frame *const in) const
 
Vec coordinatesOfFrom (const Vec &src, const Frame *const from) const
 
void getCoordinatesOf (const float src[3], float res[3]) const
 
void getInverseCoordinatesOf (const float src[3], float res[3]) const
 
void getLocalCoordinatesOf (const float src[3], float res[3]) const
 
void getLocalInverseCoordinatesOf (const float src[3], float res[3]) const
 
void getCoordinatesOfIn (const float src[3], float res[3], const Frame *const in) const
 
void getCoordinatesOfFrom (const float src[3], float res[3], const Frame *const from) const
 
Vec transformOf (const Vec &src) const
 
Vec inverseTransformOf (const Vec &src) const
 
Vec localTransformOf (const Vec &src) const
 
Vec localInverseTransformOf (const Vec &src) const
 
Vec transformOfIn (const Vec &src, const Frame *const in) const
 
Vec transformOfFrom (const Vec &src, const Frame *const from) const
 
void getTransformOf (const float src[3], float res[3]) const
 
void getInverseTransformOf (const float src[3], float res[3]) const
 
void getLocalTransformOf (const float src[3], float res[3]) const
 
void getLocalInverseTransformOf (const float src[3], float res[3]) const
 
void getTransformOfIn (const float src[3], float res[3], const Frame *const in) const
 
void getTransformOfFrom (const float src[3], float res[3], const Frame *const from) const
 
Constraintconstraint () const
 
void setConstraint (Constraint *const constraint)
 
const GLdouble * matrix () const
 
void getMatrix (GLdouble m[4][4]) const
 
void getMatrix (GLdouble m[16]) const
 
const GLdouble * worldMatrix () const
 
void getWorldMatrix (GLdouble m[4][4]) const
 
void getWorldMatrix (GLdouble m[16]) const
 
void setFromMatrix (const GLdouble m[4][4])
 
void setFromMatrix (const GLdouble m[16])
 
Frame inverse () const
 
Frame worldInverse () const
 
- Public Member Functions inherited from qglviewer::MouseGrabber
 MouseGrabber ()
 
virtual ~MouseGrabber ()
 
bool grabsMouse () const
 
bool isInMouseGrabberPool () const
 
void addInMouseGrabberPool ()
 
void removeFromMouseGrabberPool ()
 
void clearMouseGrabberPool (bool autoDelete=false)
 

Protected Member Functions

virtual void startAction (int ma, bool withConstraint=true)
 
- Protected Member Functions inherited from qglviewer::ManipulatedFrame
void computeMouseSpeed (const QMouseEvent *const e)
 
Quaternion deformedBallQuaternion (int x, int y, float cx, float cy, const Camera *const camera)
 
int mouseOriginalDirection (const QMouseEvent *const e)
 
virtual void mousePressEvent (QMouseEvent *const event, Camera *const camera)
 
virtual void mouseDoubleClickEvent (QMouseEvent *const event, Camera *const camera)
 
- Protected Member Functions inherited from qglviewer::MouseGrabber
void setGrabsMouse (bool grabs)
 

Private Slots

virtual void flyUpdate ()
 

Private Member Functions

Quaternion pitchYawQuaternion (int x, int y, const Camera *const camera)
 
Quaternion turnQuaternion (int x, const Camera *const camera)
 
void updateFlyUpVector ()
 

Private Attributes

float driveSpeed_
 
float flySpeed_
 
QTimer flyTimer_
 
Vec flyUpVector_
 
Vec revolveAroundPoint_
 

Friends

class ::QGLViewer
 
class Camera
 

Revolve around point

Vec revolveAroundPoint () const
 
void setRevolveAroundPoint (const Vec &revolveAroundPoint)
 

Fly parameters

void setFlyUpVector (const Vec &up)
 
float flySpeed () const
 
Vec flyUpVector () const
 
void setFlySpeed (float speed)
 

Mouse event handlers

virtual void mouseReleaseEvent (QMouseEvent *const event, Camera *const camera)
 
virtual void mouseMoveEvent (QMouseEvent *const event, Camera *const camera)
 
virtual void wheelEvent (QWheelEvent *const event, Camera *const camera)
 

Spinning

virtual void spin ()
 

XML representation

virtual QDomElement domElement (const QString &name, QDomDocument &document) const
 
virtual void initFromDOMElement (const QDomElement &element)
 

Additional Inherited Members

- Public Slots inherited from qglviewer::ManipulatedFrame
void setRotationSensitivity (float sensitivity)
 
void setSpinningQuaternion (const Quaternion &spinningQuaternion)
 
virtual void startSpinning (int updateInterval)
 
virtual void stopSpinning ()
 
virtual void initFromDOMElement (const QDomElement &element)
 
- Public Slots inherited from qglviewer::Frame
virtual void initFromDOMElement (const QDomElement &element)
 
- Signals inherited from qglviewer::ManipulatedFrame
void manipulated ()
 
void spun ()
 
- Signals inherited from qglviewer::Frame
void interpolated ()
 
void modified ()
 
- Static Public Member Functions inherited from qglviewer::MouseGrabber
static const QList< MouseGrabber > & MouseGrabberPool ()
 
- Protected Slots inherited from qglviewer::ManipulatedFrame
virtual void spin ()
 
- Protected Attributes inherited from qglviewer::ManipulatedFrame
int action_
 
QPoint pressPos_
 
ConstraintpreviousConstraint_
 
QPoint prevPos_
 

Detailed Description

The ManipulatedCameraFrame class represents a ManipulatedFrame 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 revolveAroundPoint(), which corresponds to the associated Camera::revolveAroundPoint().

A ManipulatedCameraFrame can also "fly" in the scene. It basically moves forward, and turns according to the mouse motion. See flySpeed(), flyUpVector() 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.

Definition at line 47 of file manipulatedCameraFrame.h.

Constructor & Destructor Documentation

ManipulatedCameraFrame::ManipulatedCameraFrame ( )

Default constructor.

flySpeed() is set to 0.0 and flyUpVector() is (0,1,0). The revolveAroundPoint() is set to (0,0,0).

Attention
Created object is removeFromMouseGrabberPool().

Definition at line 39 of file manipulatedCameraFrame.cpp.

virtual qglviewer::ManipulatedCameraFrame::~ManipulatedCameraFrame ( )
inlinevirtual

Virtual destructor. Empty.

Definition at line 59 of file manipulatedCameraFrame.h.

ManipulatedCameraFrame::ManipulatedCameraFrame ( const ManipulatedCameraFrame mcf)

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

Definition at line 60 of file manipulatedCameraFrame.cpp.

Member Function Documentation

QDomElement ManipulatedCameraFrame::domElement ( const QString &  name,
QDomDocument &  document 
) const
virtual

Returns an XML QDomElement that represents the ManipulatedCameraFrame.

Adds to the ManipulatedFrame::domElement() the ManipulatedCameraFrame specific informations in a ManipulatedCameraParameters child QDomElement.

name is the name of the QDomElement tag. doc is the QDomDocument factory used to create QDomElement.

Use initFromDOMElement() to restore the ManipulatedCameraFrame state from the resulting QDomElement.

See Vec::domElement() for a complete example. See also Quaternion::domElement(), Frame::domElement(), Camera::domElement()...

Reimplemented from qglviewer::ManipulatedFrame.

Definition at line 132 of file manipulatedCameraFrame.cpp.

float qglviewer::ManipulatedCameraFrame::flySpeed ( ) const
inline

Returns the fly speed, expressed in OpenGL units.

It corresponds to the incremental displacement that is periodically applied to the ManipulatedCameraFrame position when a QGLViewer::MOVE_FORWARD or QGLViewer::MOVE_BACKWARD QGLViewer::MouseAction is proceeded.

Attention
When the ManipulatedCameraFrame is set as the Camera::frame(), this value is set according to the QGLViewer::sceneRadius() by QGLViewer::setSceneRadius().

Definition at line 104 of file manipulatedCameraFrame.h.

void ManipulatedCameraFrame::flyUpdate ( )
privatevirtualslot

Called for continuous frame motion in fly mode (see QGLViewer::MOVE_FORWARD). Emits manipulated().

Definition at line 81 of file manipulatedCameraFrame.cpp.

Vec qglviewer::ManipulatedCameraFrame::flyUpVector ( ) const
inline

Returns the up vector used in fly mode, expressed in the world coordinate system.

Fly mode corresponds to the QGLViewer::MOVE_FORWARD and QGLViewer::MOVE_BACKWARD QGLViewer::MouseAction bindings. In these modes, horizontal displacements of the mouse rotate the ManipulatedCameraFrame around this vector. Vertical displacements rotate always around the Camera X axis.

Default value is (0,1,0), but it is updated by the Camera when set as its Camera::frame(). Camera::setOrientation() and Camera::setUpVector()) modify this value and should be used instead.

Definition at line 116 of file manipulatedCameraFrame.h.

void ManipulatedCameraFrame::initFromDOMElement ( const QDomElement &  element)
virtualslot

Restores the ManipulatedCameraFrame state from a QDomElement created by domElement().

First calls ManipulatedFrame::initFromDOMElement() and then initializes ManipulatedCameraFrame specific parameters.

Definition at line 146 of file manipulatedCameraFrame.cpp.

void ManipulatedCameraFrame::mouseMoveEvent ( QMouseEvent *const  event,
Camera *const  camera 
)
protectedvirtual

Overloading of ManipulatedFrame::mouseMoveEvent().

Motion depends on mouse binding (see mouse page for details). The resulting displacements are basically inverted from those of a ManipulatedFrame.

Reimplemented from qglviewer::ManipulatedFrame.

Definition at line 204 of file manipulatedCameraFrame.cpp.

void ManipulatedCameraFrame::mouseReleaseEvent ( QMouseEvent *const  event,
Camera *const  camera 
)
protectedvirtual

This is an overload of ManipulatedFrame::mouseReleaseEvent(). The QGLViewer::MouseAction is terminated.

Reimplemented from qglviewer::ManipulatedFrame.

Definition at line 360 of file manipulatedCameraFrame.cpp.

ManipulatedCameraFrame & ManipulatedCameraFrame::operator= ( const ManipulatedCameraFrame mcf)

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

Definition at line 49 of file manipulatedCameraFrame.cpp.

Quaternion ManipulatedCameraFrame::pitchYawQuaternion ( int  x,
int  y,
const Camera *const  camera 
)
private

Returns a Quaternion that is the composition of two rotations, inferred from the mouse pitch (X axis) and yaw (flyUpVector() axis).

Definition at line 436 of file manipulatedCameraFrame.cpp.

Vec qglviewer::ManipulatedCameraFrame::revolveAroundPoint ( ) const
inline

Returns the point the ManipulatedCameraFrame revolves around when rotated.

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

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

Definition at line 75 of file manipulatedCameraFrame.h.

void qglviewer::ManipulatedCameraFrame::setFlySpeed ( float  speed)
inlineslot

Sets the flySpeed(), defined in OpenGL units.

Default value is 0.0, but it is modified according to the QGLViewer::sceneRadius() when the ManipulatedCameraFrame is set as the Camera::frame().

Definition at line 87 of file manipulatedCameraFrame.h.

void qglviewer::ManipulatedCameraFrame::setFlyUpVector ( const Vec up)
inline

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

Default value is (0,1,0), but it is updated by the Camera when set as its Camera::frame(). Use Camera::setUpVector() instead in that case.

Definition at line 93 of file manipulatedCameraFrame.h.

void qglviewer::ManipulatedCameraFrame::setRevolveAroundPoint ( const Vec revolveAroundPoint)
inline

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

Definition at line 77 of file manipulatedCameraFrame.h.

void ManipulatedCameraFrame::spin ( )
protectedvirtualslot

Overloading of ManipulatedFrame::spin().

Rotates the ManipulatedCameraFrame around its revolveAroundPoint() instead of its origin.

Definition at line 73 of file manipulatedCameraFrame.cpp.

void ManipulatedCameraFrame::startAction ( int  ma,
bool  withConstraint = true 
)
protectedvirtual

Protected internal method used to handle mouse events.

Reimplemented from qglviewer::ManipulatedFrame.

Definition at line 180 of file manipulatedCameraFrame.cpp.

Quaternion ManipulatedCameraFrame::turnQuaternion ( int  x,
const Camera *const  camera 
)
private

Returns a Quaternion that is a rotation around current camera Y, proportionnal to the horizontal mouse position.

Definition at line 429 of file manipulatedCameraFrame.cpp.

void ManipulatedCameraFrame::updateFlyUpVector ( )
private

This method will be called by the Camera when its orientation is changed, so that the flyUpVector (private) is changed accordingly. You should not need to call this method.

Definition at line 110 of file manipulatedCameraFrame.cpp.

void ManipulatedCameraFrame::wheelEvent ( QWheelEvent *const  event,
Camera *const  camera 
)
protectedvirtual

This is an overload of ManipulatedFrame::wheelEvent().

The wheel behavior depends on the wheel binded action. Current possible actions are QGLViewer::ZOOM, QGLViewer::MOVE_FORWARD, QGLViewer::MOVE_BACKWARD. QGLViewer::ZOOM speed depends on wheelSensitivity() while QGLViewer::MOVE_FORWARD and QGLViewer::MOVE_BACKWARD depend on flySpeed(). See QGLViewer::setWheelBinding() to customize the binding.

Reimplemented from qglviewer::ManipulatedFrame.

Definition at line 377 of file manipulatedCameraFrame.cpp.

Friends And Related Function Documentation

friend class ::QGLViewer
friend

Definition at line 51 of file manipulatedCameraFrame.h.

friend class Camera
friend

Definition at line 50 of file manipulatedCameraFrame.h.

Member Data Documentation

float qglviewer::ManipulatedCameraFrame::driveSpeed_
private

Definition at line 157 of file manipulatedCameraFrame.h.

float qglviewer::ManipulatedCameraFrame::flySpeed_
private

Definition at line 156 of file manipulatedCameraFrame.h.

QTimer qglviewer::ManipulatedCameraFrame::flyTimer_
private

Definition at line 159 of file manipulatedCameraFrame.h.

Vec qglviewer::ManipulatedCameraFrame::flyUpVector_
private

Definition at line 158 of file manipulatedCameraFrame.h.

Vec qglviewer::ManipulatedCameraFrame::revolveAroundPoint_
private

Definition at line 161 of file manipulatedCameraFrame.h.


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


octovis
Author(s): Kai M. Wurm , Armin Hornung
autogenerated on Mon Jun 10 2019 14:00:25