GEL
2
GEL is a library for Geometry and Linear Algebra
|
This class represents a virtual tracball. More...
#include <QuatTrackBall.h>
Public Member Functions | |
QuatTrackBall (const CGLA::Vec3f &, float, unsigned, unsigned) | |
void | set_screen_window (unsigned _width, unsigned _height) |
Set window dimensions. | |
void | set_centre (const CGLA::Vec3f &_centre) |
set the centre point of rotation | |
void | set_screen_centre (const CGLA::Vec2i &_screen_centre) |
const CGLA::Quatf & | get_rotation () const |
void | set_rotation (const CGLA::Quatf &_qrot) |
void | set_eye_dist (float _eye_dist) |
float | get_eye_dist () const |
void | set_gl_modelview () const |
Call GL to set up viewing. | |
void | do_spin () |
bool | is_spinning () const |
void | stop_spin () |
Zeroes the rotation value - makes everything stop. | |
void | grab_ball (TrackBallAction, const CGLA::Vec2i &) |
Call this function to start action when mouse button is pressed. | |
void | roll_ball (const CGLA::Vec2i &) |
Call this function to perform action when user drags mouse. | |
void | release_ball () |
Call this function to stop action when mouse is released. | |
bool | is_grabbed () const |
Returns true if the ball is `grabbed' and not released yet. | |
void | get_view_param (CGLA::Vec3f &eye, CGLA::Vec3f &_centre, CGLA::Vec3f &up) const |
TrackBallAction | get_current_action () |
This class represents a virtual tracball.
Use it in GLUT, FLTK or other OpenGL programs to allow the user to spin the model being rendered. It needs work to be used with non-GL apps since it calls GL API functions.
GLGraphics::QuatTrackBall::QuatTrackBall | ( | const CGLA::Vec3f & | _centre, |
float | _eye_dist, | ||
unsigned | _width, | ||
unsigned | _height | ||
) |
First constructor argument is the point we look at. The second argument is the distance to eye point. The third is the scaling factor the last two arguments are the window dimensions.
void GLGraphics::QuatTrackBall::do_spin | ( | ) |
Spin. used both to spin while button is pressed and if the ball is just spinning while program is idling.