#include <spinningFrame.h>
Inherits Frame.
Inherited by ManipulatedFrame.
Spinning parameters | |
Quaternion | spinningQuaternion () const |
Vec | rotationCenter () const |
bool | rotatesAroundCenter () const |
bool | orientationIsFrozen () const |
void | setSpinningQuaternion (const Quaternion &q) |
void | setRotationCenter (const Vec ¢er) |
void | setRotateAroundCenter (const bool rac=true) |
void | freezeOrientation (const bool fo=true) |
Timer configuration | |
bool | isSpinning () const |
int | updateInterval () const |
virtual void | startSpinning (const int msecs=-1) |
virtual void | stopSpinning () |
void | setUpdateInterval (const int msecs) |
Signals | |
void | spinned () |
Public Member Functions | |
SpinningFrame () | |
virtual | ~SpinningFrame () |
SpinningFrame (const SpinningFrame &sf) | |
SpinningFrame & | operator= (const SpinningFrame &s) |
virtual QDomElement | domElement (const QString &name, QDomDocument &doc) const |
virtual void | initFromDOMElement (const QDomElement &e) |
Protected Slots | |
void | spin () |
A SpinningFrame is useful to animate some objects of the scene :
init() { sf = new SpinningFrame(); // Update display after each update of the SpinningFrame connect(sf, SIGNAL(spinned()), SLOT(updateGL())); // Rotation around the Z axis, with a increment of 0.04 radian. sf->setSpinningQuaternion(Quaternion(Vec(0,0,1), 0.04)); sf->startSpinning(); } draw() { glPushMatrix(); glMultMatrixd(sf->matrix()); // Draw your spinning object here. glPopMatrix(); }
When rotatesAroundCenter() is true
, the SpinningFrame will rotate around the rotationCenter() (defined in the world coordinate system). Use setRotateAroundCenter() and setRotationCenter() to change these values.
Additionally, when rotatesAroundCenter() is true
, you can freeze the Frame orientation using freezeOrientation(). The Frame will then describe circles around the rotationCenter(), but its orientation will remain unchanged.
See the spinningFrame example for an illustration.
The spinningQuaternion() axis is always defined in the SpinningFrame coordinate system. You may want to use Frame::transformOfFrom() to convert this axis from an other Frame.
The ManipulatedFrame and ManipulatedCameraFrame classes both derive from this class and can hence have a continuous spinning motion (by default, this happens when the mouse button is released while moving the mouse quickly enough, see ManipulatedFrame::setSpinningSensitivity()).
When spinning, the SpinningFrame emits a spinned() signal, which should usually be connected to the viewer's updateGL() slot, so that successive updates of the SpinningFrame orientation are all displayed. See the spinned() documentation for details.
|
Constructor sets default values : isSpinning() is |
|
Virtual destructor. Empty. |
|
Copy constructor. Performs a deep copy of all members using operator=(). Signal and slot connections are not copied. If |
|
Creates an XML QDomElement that represents the SpinningFrame. Adds to Frame::domElement() the SpinningFrame specific informations. Use initFromDOMElement() to restore the SpinningFrame state from the resulting domElement. Reimplemented from Frame. Reimplemented in ManipulatedCameraFrame, and ManipulatedFrame. |
|
Defines whether or not orientationIsFrozen(). Default value is |
|
Restore the SpinningFrame state from a QDomElement created by domElement(). See also Frame::initFromDOMElement().
Fields that are not described in the Reimplemented from Frame. Reimplemented in ManipulatedCameraFrame, and ManipulatedFrame. |
|
|
|
Classical = operator. Signal and slot connections are not copied. If |
|
This value is only meaningful when the SpinningFrame rotatesAroundCenter(). In that case, it indicates whether or not the world orientation of the SpinningFrame is modified when it is rotated. Default value is |
|
When set to |
|
Current spinning rotation center. Set using setRotationCenter(). See the Detailed Description section for more explanations. |
|
Defines whether or not the SpinningFrame rotatesAroundCenter(). Default value is |
|
Defines the current rotationCenter(). This value will be used only when rotatesAroundCenter() is |
|
Defines the current spinningQuaternion(). |
|
Defines the update interval, defined in milliseconds. Default value is 40. Get current value from updateInterval().
|
|
Update the Frame orientation (and possibly position), according to the SpinningFrame parameters. When the SpinningFrame rotatesAroundCenter(), it rotates around its rotationCenter(). Its orientation() is unchanged when orientationIsFrozen(), and modified according to the rotation otherwise. When the SpinningFrame does not rotatesAroundCenter() (default), it is simply rotated (around its own origin). |
|
This signal is emitted whenever the frame is spinning. Connect this signal to any object that should be notified, and especially the viewer(s) :
Use QGLViewer::connectSignalToAllViewers() to connect this signal to all the viewers' updateGL() slots. Note that for every QGLViewer, its QGLViewer::manipulatedFrame() and its QGLViewer::camera() Camera::frame() are SpinningFrame. For these, the spinned() signal is automatically connected to the QGLViewer updateGL() slot. See also the ManipulatedFrame::manipulated() and KeyFrameInterpolator::interpolated() signals documentations. |
|
This is the incremental rotation that will be applied to the SpinningFrame orientation, every updateInterval() milliseconds, when the SpinningFrame isSpinning(). Default value is a null rotation. Use setSpinningQuaternion() to define this value. More complex rotation motion can be achieved using the rotationCenter() and freezeOrientation(). See the Detailed Description section. |
|
Starts the spinning of the frame. Use stopSpinning() to stop.
See the spinningFrame example for an illustration. |
|
Stops the spinning which was initiated with startSpinning(). |
|
Returns the current update interval of the SpinningFrame. See isSpinning() to know if the Frame is actually spinning. This value can be set with setUpdateInterval() or with startSpinning(). |