DART  6.10.1
dart::gui::Trackball Class Reference

#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
 

Constructor & Destructor Documentation

◆ Trackball() [1/2]

dart::gui::Trackball::Trackball ( )

Default constructor.

◆ Trackball() [2/2]

dart::gui::Trackball::Trackball ( const Eigen::Vector2d &  _center,
double  _radius 
)

Constructor.

Member Function Documentation

◆ applyGLRotation()

void dart::gui::Trackball::applyGLRotation ( )

Apply the current rotation to openGL env.

◆ draw()

void dart::gui::Trackball::draw ( int  _winWidth,
int  _winHeight 
)

Draw the trackball on screen.

◆ getCenter()

Eigen::Vector2d dart::gui::Trackball::getCenter ( ) const

◆ getCurrQuat()

Eigen::Quaterniond dart::gui::Trackball::getCurrQuat ( ) const

◆ getRadius()

double dart::gui::Trackball::getRadius ( ) const

◆ getRotationMatrix()

Eigen::Matrix3d dart::gui::Trackball::getRotationMatrix ( ) const

◆ mouseOnSphere()

Eigen::Vector3d dart::gui::Trackball::mouseOnSphere ( double  _mouseX,
double  _mouseY 
) const
private

Project screen coordinate (x,y) to the trackball.

◆ quatFromVectors()

Eigen::Quaterniond dart::gui::Trackball::quatFromVectors ( const Eigen::Vector3d &  _from,
const Eigen::Vector3d &  _to 
) const
private

Compute the quaternion that rotates from vector "from" to vector "to".

◆ setCenter()

void dart::gui::Trackball::setCenter ( const Eigen::Vector2d &  _center)

◆ setQuaternion()

void dart::gui::Trackball::setQuaternion ( const Eigen::Quaterniond &  _q)

◆ setRadius()

void dart::gui::Trackball::setRadius ( const double  _radius)

◆ setTrackball()

void dart::gui::Trackball::setTrackball ( const Eigen::Vector2d &  _center,
const double  _radius 
)

◆ startBall()

void dart::gui::Trackball::startBall ( double  _x,
double  _y 
)

Set the starting position to the project of (x,y) on the trackball.

◆ updateBall()

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.

Member Data Documentation

◆ mCenter

Eigen::Vector2d dart::gui::Trackball::mCenter
private

◆ mCurrQuat

Eigen::Quaterniond dart::gui::Trackball::mCurrQuat
private

◆ mRadius

double dart::gui::Trackball::mRadius
private

◆ mStartPos

Eigen::Vector3d dart::gui::Trackball::mStartPos
private