manipulatedCameraFrame.cpp
38 : driveSpeed_(0.0), sceneUpVector_(0.0, 1.0, 0.0), rotatesAroundUpVector_(false), zoomsOnPivotPoint_(false)
101 // Needs to be out of the switch since ZOOM/fastDraw()/wheelEvent use this callback to trigger a final draw().
142 QDomElement ManipulatedCameraFrame::domElement(const QString& name, QDomDocument& document) const
221 const float coef = qMax(fabsf((camera->frame()->coordinatesOf(camera->pivotPoint())).z), 0.2f * sceneRadius);
328 const float angle = atan2(event->y() - trans[1], event->x() - trans[0]) - atan2(prevPos_.y()-trans[1], prevPos_.x()-trans[0]);
398 if ((action_ == QGLViewer::MOVE_FORWARD) || (action_ == QGLViewer::MOVE_BACKWARD) || (action_ == QGLViewer::DRIVE))
448 // This could also be done *before* manipulated is emitted, so that isManipulated() returns false.
459 return Quaternion(Vec(0.0, 1.0, 0.0), rotationSensitivity()*(prevPos_.x()-x)/camera->screenWidth());
466 const Quaternion rotX(Vec(1.0, 0.0, 0.0), rotationSensitivity()*(prevPos_.y()-y)/camera->screenHeight());
467 const Quaternion rotY(transformOf(sceneUpVector()), rotationSensitivity()*(prevPos_.x()-x)/camera->screenWidth());
void fitScreenRegion(const QRect &rectangle)
Moves the Camera so that the rectangular screen region defined by rectangle (pixel units...
Definition: camera.cpp:1058
Vec projectedCoordinatesOf(const Vec &src, const Frame *frame=NULL) const
Returns the screen projected coordinates of a point src defined in the frame coordinate system...
Definition: camera.cpp:1584
ManipulatedCameraFrame & operator=(const ManipulatedCameraFrame &mcf)
Equal operator.
Definition: manipulatedCameraFrame.cpp:46
Definition: camera.h:29
The ManipulatedCameraFrame class represents a ManipulatedFrame with Camera specific mouse bindings...
Definition: manipulatedCameraFrame.h:47
float deltaWithPrevPos(QMouseEvent *const event, Camera *const camera) const
Returns a screen scaled delta from event's position to prevPos_, along the X or Y direction...
Definition: manipulatedFrame.cpp:275
virtual void initFromDOMElement(const QDomElement &element)
Restores the ManipulatedFrame state from a QDomElement created by domElement().
Definition: manipulatedFrame.cpp:138
Vec pivotPoint() const
The point the Camera pivots around with the QGLViewer::ROTATE mouse binding.
Definition: camera.cpp:1275
A ManipulatedFrame is a Frame that can be rotated and translated using the mouse. ...
Definition: manipulatedFrame.h:95
float flySpeed() const
Returns the fly speed, expressed in OpenGL units.
Definition: manipulatedCameraFrame.h:156
bool rotatesAroundUpVector() const
Returns true when the frame's rotation is constrained around the sceneUpVector(), and false otherwise...
Definition: manipulatedCameraFrame.h:106
void translate(Vec &t)
Same as translate(const Vec&) but t may be modified to satisfy the translation constraint().
Definition: frame.cpp:335
Quaternion spinningQuaternion() const
Returns the incremental rotation that is applied by spin() to the ManipulatedFrame orientation when i...
Definition: manipulatedFrame.h:231
Vec pivotPoint() const
Returns the point the ManipulatedCameraFrame pivot point, around which the camera rotates...
Definition: manipulatedCameraFrame.h:75
int screenWidth() const
Returns the width (in pixels) of the Camera screen.
Definition: camera.h:190
void rotateAroundPoint(Quaternion &rotation, const Vec &point)
Makes the Frame rotate() by rotation around point.
Definition: frame.cpp:414
void setRotatesAroundUpVector(bool constrained)
Sets the value of rotatesAroundUpVector().
Definition: manipulatedCameraFrame.h:110
ManipulatedCameraFrame * frame() const
Returns the ManipulatedCameraFrame attached to the Camera.
Definition: camera.h:334
float rotationSensitivity() const
Returns the influence of a mouse displacement on the ManipulatedFrame rotation.
Definition: manipulatedFrame.h:161
int screenHeight() const
Returns the height (in pixels) of the Camera screen.
Definition: camera.h:195
Vec coordinatesOf(const Vec &src) const
Returns the Frame coordinates of a point src defined in the world coordinate system (converts from wo...
Definition: frame.cpp:702
float fieldOfView() const
Returns the vertical field of view of the Camera (in radians).
Definition: camera.h:170
float wheelDelta(const QWheelEvent *event) const
Returns a normalized wheel delta, proportionnal to wheelSensitivity().
Definition: manipulatedFrame.cpp:283
void rotate(Quaternion &q)
Same as rotate(const Quaternion&) but q may be modified to satisfy the rotation constraint().
Definition: frame.cpp:376
virtual void getOrthoWidthHeight(GLdouble &halfWidth, GLdouble &halfHeight) const
Returns the halfWidth and halfHeight of the Camera orthographic frustum.
Definition: camera.cpp:324
virtual QDomElement domElement(const QString &name, QDomDocument &document) const
Returns an XML QDomElement that represents the ManipulatedCameraFrame.
Definition: manipulatedCameraFrame.cpp:142
void setFlySpeed(float speed)
Sets the flySpeed(), defined in OpenGL units.
Definition: manipulatedCameraFrame.h:139
virtual void startAction(int ma, bool withConstraint=true)
Protected internal method used to handle mouse events.
Definition: manipulatedCameraFrame.cpp:194
float translationSensitivity() const
Returns the influence of a mouse displacement on the ManipulatedFrame translation.
Definition: manipulatedFrame.h:180
virtual void mouseReleaseEvent(QMouseEvent *const event, Camera *const camera)
Stops the ManipulatedFrame mouse manipulation.
Definition: manipulatedFrame.cpp:461
void removeFromMouseGrabberPool()
Removes the MouseGrabber from the MouseGrabberPool().
Definition: mouseGrabber.cpp:57
void setSpinningQuaternion(const Quaternion &spinningQuaternion)
Defines the spinningQuaternion().
Definition: manipulatedFrame.h:235
Vec localInverseTransformOf(const Vec &src) const
Returns the referenceFrame() transform of a vector src defined in the Frame coordinate system (conver...
Definition: frame.cpp:881
The Quaternion class represents 3D rotations and orientations.
Definition: quaternion.h:66
void manipulated()
This signal is emitted when ever the ManipulatedFrame is manipulated (i.e.
void setConstraint(Constraint *const constraint)
Sets the constraint() attached to the Frame.
Definition: frame.h:361
virtual void wheelEvent(QWheelEvent *const event, Camera *const camera)
This is an overload of ManipulatedFrame::wheelEvent().
Definition: manipulatedCameraFrame.cpp:413
virtual QDomElement domElement(const QString &name, QDomDocument &document) const
Returns an XML QDomElement that represents the ManipulatedFrame.
Definition: manipulatedFrame.cpp:116
Quaternion deformedBallQuaternion(int x, int y, float cx, float cy, const Camera *const camera)
Returns a quaternion computed according to the mouse motion.
Definition: manipulatedFrame.cpp:534
int mouseOriginalDirection(const QMouseEvent *const e)
Return 1 if mouse motion was started horizontally and -1 if it was more vertical. ...
Definition: manipulatedFrame.cpp:255
ManipulatedFrame & operator=(const ManipulatedFrame &mf)
Equal operator.
Definition: manipulatedFrame.cpp:60
void setZoomsOnPivotPoint(bool enabled)
Sets the value of zoomsOnPivotPoint().
Definition: manipulatedCameraFrame.h:124
Vec transformOf(const Vec &src) const
Returns the Frame transform of a vector src defined in the world coordinate system (converts vectors ...
Definition: frame.cpp:843
Vec position() const
Returns the position of the Frame, defined in the world coordinate system.
Definition: frame.cpp:537
float sceneRadius() const
Returns the radius of the scene observed by the Camera.
Definition: camera.h:284
Vec inverseTransformOf(const Vec &src) const
Returns the world transform of the vector whose coordinates in the Frame coordinate system is src (co...
Definition: frame.cpp:856
void computeMouseSpeed(const QMouseEvent *const e)
Updates mouse speed, measured in pixels/milliseconds.
Definition: manipulatedFrame.cpp:241
virtual void mouseReleaseEvent(QMouseEvent *const event, Camera *const camera)
This is an overload of ManipulatedFrame::mouseReleaseEvent().
Definition: manipulatedCameraFrame.cpp:396
virtual void startAction(int ma, bool withConstraint=true)
Protected internal method used to handle mouse events.
Definition: manipulatedFrame.cpp:208
Vec sceneUpVector() const
Returns the up vector of the scene, expressed in the world coordinate system.
Definition: manipulatedCameraFrame.h:171
bool zoomsOnPivotPoint() const
Returns whether or not the QGLViewer::ZOOM action zooms on the pivot point.
Definition: manipulatedCameraFrame.h:120
virtual void mouseMoveEvent(QMouseEvent *const event, Camera *const camera)
Overloading of ManipulatedFrame::mouseMoveEvent().
Definition: manipulatedCameraFrame.cpp:233
virtual void initFromDOMElement(const QDomElement &element)
Restores the ManipulatedCameraFrame state from a QDomElement created by domElement().
Definition: manipulatedCameraFrame.cpp:158
void setSceneUpVector(const Vec &up)
Sets the sceneUpVector(), defined in the world coordinate system.
Definition: manipulatedCameraFrame.h:145
virtual void spin()
Overloading of ManipulatedFrame::spin().
Definition: manipulatedCameraFrame.cpp:72