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