DART
6.7.3
|
#include <Trackball.hpp>
Public Member Functions | |
EIGEN_MAKE_ALIGNED_OPERATOR_NEW | Trackball () |
Default constructor. More... | |
Trackball (const Eigen::Vector2d &_center, double _radius) | |
Constructor. More... | |
void | startBall (double _x, double _y) |
Set the starting position to the project of (x,y) on the trackball. More... | |
void | updateBall (double _x, double _y) |
Update the current rotation to rotate from mStartPos to the projection of (x,y) on trackball, then update mStartPos. More... | |
void | applyGLRotation () |
Apply the current rotation to openGL env. More... | |
void | draw (int _winWidth, int _winHeight) |
Draw the trackball on screen. More... | |
void | setTrackball (const Eigen::Vector2d &_center, const double _radius) |
void | setCenter (const Eigen::Vector2d &_center) |
void | setRadius (const double _radius) |
void | setQuaternion (const Eigen::Quaterniond &_q) |
Eigen::Quaterniond | getCurrQuat () const |
Eigen::Matrix3d | getRotationMatrix () const |
Eigen::Vector2d | getCenter () const |
double | getRadius () const |
Private Member Functions | |
Eigen::Vector3d | mouseOnSphere (double _mouseX, double _mouseY) const |
Project screen coordinate (x,y) to the trackball. More... | |
Eigen::Quaterniond | quatFromVectors (const Eigen::Vector3d &_from, const Eigen::Vector3d &_to) const |
Compute the quaternion that rotates from vector "from" to vector "to". More... | |
Private Attributes | |
Eigen::Vector2d | mCenter |
double | mRadius |
Eigen::Vector3d | mStartPos |
Eigen::Quaterniond | mCurrQuat |
dart::gui::Trackball::Trackball | ( | ) |
Default constructor.
dart::gui::Trackball::Trackball | ( | const Eigen::Vector2d & | _center, |
double | _radius | ||
) |
Constructor.
void dart::gui::Trackball::applyGLRotation | ( | ) |
Apply the current rotation to openGL env.
void dart::gui::Trackball::draw | ( | int | _winWidth, |
int | _winHeight | ||
) |
Draw the trackball on screen.
Eigen::Vector2d dart::gui::Trackball::getCenter | ( | ) | const |
Eigen::Quaterniond dart::gui::Trackball::getCurrQuat | ( | ) | const |
double dart::gui::Trackball::getRadius | ( | ) | const |
Eigen::Matrix3d dart::gui::Trackball::getRotationMatrix | ( | ) | const |
|
private |
Project screen coordinate (x,y) to the trackball.
|
private |
Compute the quaternion that rotates from vector "from" to vector "to".
void dart::gui::Trackball::setCenter | ( | const Eigen::Vector2d & | _center | ) |
void dart::gui::Trackball::setQuaternion | ( | const Eigen::Quaterniond & | _q | ) |
void dart::gui::Trackball::setRadius | ( | const double | _radius | ) |
void dart::gui::Trackball::setTrackball | ( | const Eigen::Vector2d & | _center, |
const double | _radius | ||
) |
void dart::gui::Trackball::startBall | ( | double | _x, |
double | _y | ||
) |
Set the starting position to the project of (x,y) on the trackball.
void dart::gui::Trackball::updateBall | ( | double | _x, |
double | _y | ||
) |
Update the current rotation to rotate from mStartPos to the projection of (x,y) on trackball, then update mStartPos.
|
private |
|
private |
|
private |
|
private |