manipulatedFrame.cpp
97 setGrabsMouse(keepsGrabbingMouse_ || ((fabs(x-proj.x) < thresold) && (fabs(y-proj.y) < thresold)));
197 QGLViewer::SCREEN_ROTATE) without a spun emission. Much nicer to use the spinningQuaternion() and
212 // #CONNECTION# manipulatedFrame::wheelEvent, manipulatedCameraFrame::wheelEvent and mouseReleaseEvent()
275 float ManipulatedFrame::deltaWithPrevPos(QMouseEvent* const event, Camera* const camera) const {
313 // action_ should no longer possibly be NO_MOUSE_ACTION since this value is not inserted in mouseBinding_
341 trans *= 2.0 * tan(camera->fieldOfView()/2.0) * fabs((camera->frame()->coordinatesOf(position())).z) / camera->screenHeight();
394 trans *= 2.0 * tan(camera->fieldOfView()/2.0) * fabs((camera->frame()->coordinatesOf(position())).z) / camera->screenHeight();
442 // Possible when the ManipulatedFrame is a MouseGrabber. This method is then called without startAction
471 if (((action_ == QGLViewer::ROTATE) || (action_ == QGLViewer::SCREEN_ROTATE)) && (mouseSpeed_ >= spinningSensitivity()))
534 Quaternion ManipulatedFrame::deformedBallQuaternion(int x, int y, float cx, float cy, const Camera* const camera)
void spun()
This signal is emitted when the ManipulatedFrame isSpinning().
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
Definition: camera.h:29
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 Frame state from a QDomElement created by domElement().
Definition: frame.cpp:1011
virtual void initFromDOMElement(const QDomElement &element)
Restores the ManipulatedFrame state from a QDomElement created by domElement().
Definition: manipulatedFrame.cpp:138
virtual QDomElement domElement(const QString &name, QDomDocument &document) const
Returns an XML QDomElement that represents the Frame.
Definition: frame.cpp:994
A ManipulatedFrame is a Frame that can be rotated and translated using the mouse. ...
Definition: manipulatedFrame.h:95
void translate(Vec &t)
Same as translate(const Vec&) but t may be modified to satisfy the translation constraint().
Definition: frame.cpp:335
MouseAction
Defines the possible actions that can be binded to a mouse action (a click, followed by a mouse displ...
Definition: qglviewer.h:969
Quaternion spinningQuaternion() const
Returns the incremental rotation that is applied by spin() to the ManipulatedFrame orientation when i...
Definition: manipulatedFrame.h:231
void alignWithFrame(const Frame *const frame, bool move=false, float threshold=0.0f)
Aligns the Frame with frame, so that two of their axis are parallel.
Definition: frame.cpp:1055
float wheelSensitivity() const
Returns the mouse wheel sensitivity.
Definition: manipulatedFrame.h:209
int screenWidth() const
Returns the width (in pixels) of the Camera screen.
Definition: camera.h:190
virtual void mouseDoubleClickEvent(QMouseEvent *const event, Camera *const camera)
Overloading of MouseGrabber::mouseDoubleClickEvent().
Definition: manipulatedFrame.cpp:482
Vec viewDirection() const
Returns the normalized view direction of the Camera, defined in the world coordinate system...
Definition: camera.cpp:1220
ManipulatedCameraFrame * frame() const
Returns the ManipulatedCameraFrame attached to the Camera.
Definition: camera.h:334
Abstract class for objects that grab mouse focus in a QGLViewer.
Definition: mouseGrabber.h:130
float rotationSensitivity() const
Returns the influence of a mouse displacement on the ManipulatedFrame rotation.
Definition: manipulatedFrame.h:161
virtual void checkIfGrabsMouse(int x, int y, const Camera *const camera)
Implementation of the MouseGrabber main method.
Definition: manipulatedFrame.cpp:93
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
void setSpinningSensitivity(float sensitivity)
Defines the spinningSensitivity(), in pixels per milliseconds.
Definition: manipulatedFrame.h:146
virtual void getOrthoWidthHeight(GLdouble &halfWidth, GLdouble &halfHeight) const
Returns the halfWidth and halfHeight of the Camera orthographic frustum.
Definition: camera.cpp:324
virtual void spin()
Rotates the ManipulatedFrame by its spinningQuaternion().
Definition: manipulatedFrame.cpp:191
void setRotationSensitivity(float sensitivity)
Defines the rotationSensitivity().
Definition: manipulatedFrame.h:142
Quaternion orientation() const
Returns the orientation of the Frame, defined in the world coordinate system.
Definition: frame.cpp:546
void setWheelSensitivity(float sensitivity)
Defines the wheelSensitivity().
Definition: manipulatedFrame.h:148
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
virtual void wheelEvent(QWheelEvent *const event, Camera *const camera)
Overloading of MouseGrabber::wheelEvent().
Definition: manipulatedFrame.cpp:497
virtual void mouseMoveEvent(QMouseEvent *const event, Camera *const camera)
Modifies the ManipulatedFrame according to the mouse motion.
Definition: manipulatedFrame.cpp:329
void projectOnLine(const Vec &origin, const Vec &direction)
Translates the Frame so that its position() lies on the line defined by origin and direction (defined...
Definition: frame.cpp:1133
void setSpinningQuaternion(const Quaternion &spinningQuaternion)
Defines the spinningQuaternion().
Definition: manipulatedFrame.h:235
void setZoomSensitivity(float sensitivity)
Defines the zoomSensitivity().
Definition: manipulatedFrame.h:150
The Quaternion class represents 3D rotations and orientations.
Definition: quaternion.h:66
const Frame * referenceFrame() const
Returns the reference Frame, in which coordinates system the Frame is defined.
Definition: frame.h:262
void manipulated()
This signal is emitted when ever the ManipulatedFrame is manipulated (i.e.
bool grabsMouse() const
Returns true when the MouseGrabber grabs the QGLViewer's mouse events.
Definition: mouseGrabber.h:179
void setConstraint(Constraint *const constraint)
Sets the constraint() attached to the Frame.
Definition: frame.h:361
virtual void mousePressEvent(QMouseEvent *const event, Camera *const camera)
Initiates the ManipulatedFrame mouse manipulation.
Definition: manipulatedFrame.cpp:305
virtual void stopSpinning()
Stops the spinning motion started using startSpinning().
Definition: manipulatedFrame.h:239
bool isManipulated() const
Returns true when the ManipulatedFrame is being manipulated with the mouse.
Definition: manipulatedFrame.cpp:174
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
The Frame class represents a coordinate system, defined by a position and an orientation.
Definition: frame.h:121
void setTranslationSensitivity(float sensitivity)
Defines the translationSensitivity().
Definition: manipulatedFrame.h:144
virtual void startSpinning(int updateInterval)
Starts the spinning of the ManipulatedFrame.
Definition: manipulatedFrame.cpp:183
Vec position() const
Returns the Camera position (the eye), defined in the world coordinate system.
Definition: camera.cpp:1200
ManipulatedFrame & operator=(const ManipulatedFrame &mf)
Equal operator.
Definition: manipulatedFrame.cpp:60
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 rotate(const Vec &v) const
Returns the image of v by the Quaternion rotation.
Definition: quaternion.cpp:76
Vec position() const
Returns the position of the Frame, defined in the world coordinate system.
Definition: frame.cpp:537
float spinningSensitivity() const
Returns the minimum mouse speed required (at button release) to make the ManipulatedFrame spin()...
Definition: manipulatedFrame.h:192
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 startAction(int ma, bool withConstraint=true)
Protected internal method used to handle mouse events.
Definition: manipulatedFrame.cpp:208
Constraint * constraint() const
Returns the current constraint applied to the Frame.
Definition: frame.h:356