A container class to deal with a trackball, use ArcBall paradigm. More...
Public Member Functions | |
trackball () | |
const quaternion & | quat () const |
get the current quaternion | |
quaternion & | quat () |
get the current quaternion | |
const quaternion & | d_quat () const |
get the quaternion to apply | |
quaternion & | d_quat () |
get the quaternion to apply | |
double & | radius () |
get the disc radius | |
const double & | radius () const |
get the disc radius | |
double | project_to_disc (const double &x, const double &y) const |
return the distance to disc for the 3D coordinate | |
void | set_2d_coords (const double &x0, const double &y0, const double &x1, const double &y1) |
given a set of 2d coords difference, return the corresponding quaternion | |
void | apply_rotation () |
multiply d_q to current_q | |
void | no_motion () |
Set d_q to 0. | |
Private Attributes | |
quaternion | current_q |
the current quaternion | |
quaternion | d_q |
the quaternion to apply | |
double | disc_radius |
internal parameter of the disc radius |
A container class to deal with a trackball, use ArcBall paradigm.
cpe::trackball::trackball | ( | ) |
initial constructor
void cpe::trackball::apply_rotation | ( | ) |
multiply d_q to current_q
References cpe::quaternion::conjugated(), current_q, and d_q.
Referenced by cpe::navigator_tool::trackball_rotate().
quaternion & cpe::trackball::d_quat | ( | ) |
get the quaternion to apply
References d_q.
const quaternion & cpe::trackball::d_quat | ( | ) | const |
get the quaternion to apply
References d_q.
void cpe::trackball::no_motion | ( | ) |
Set d_q to 0.
References d_q.
double cpe::trackball::project_to_disc | ( | const double & | x, | |
const double & | y | |||
) | const |
return the distance to disc for the 3D coordinate
References disc_radius.
Referenced by set_2d_coords().
quaternion & cpe::trackball::quat | ( | ) |
get the current quaternion
References current_q.
const quaternion & cpe::trackball::quat | ( | ) | const |
get the current quaternion
References current_q.
Referenced by cpe::navigator_tool::camera_orientation(), cpe::navigator_tool::go_forward(), cpe::navigator_tool::go_right(), and cpe::navigator_tool::go_up().
const double & cpe::trackball::radius | ( | ) | const |
get the disc radius
References disc_radius.
double & cpe::trackball::radius | ( | ) |
get the disc radius
References disc_radius.
void cpe::trackball::set_2d_coords | ( | const double & | x0, | |
const double & | y0, | |||
const double & | x1, | |||
const double & | y1 | |||
) |
given a set of 2d coords difference, return the corresponding quaternion
References cpe::v3::cross(), d_q, disc_radius, cpe::v3::norm(), and project_to_disc().
Referenced by cpe::navigator_tool::trackball_rotate().
quaternion cpe::trackball::current_q [private] |
the current quaternion
Referenced by apply_rotation(), and quat().
quaternion cpe::trackball::d_q [private] |
the quaternion to apply
Referenced by apply_rotation(), d_quat(), no_motion(), and set_2d_coords().
double cpe::trackball::disc_radius [private] |
internal parameter of the disc radius
Referenced by project_to_disc(), radius(), and set_2d_coords().