#include <sglSphericalTransform.hpp>
Inheritance diagram for sglSphericalTransform::
Public Types | |
enum | ModeEnum { eX_UP, eY_UP, eZ_UP } |
Public Methods | |
sglSphericalTransform () | |
virtual | ~sglSphericalTransform () |
void | setMode (ModeEnum mode) |
ModeEnum | getMode () const |
virtual void | reset () |
void | updateAzimuth (T delta_azimuth) |
void | updateElevation (T delta_elevation) |
void | updateRadius (T delta_radius) |
void | updateCOI (const sglVec3< T > &delta_coi) |
void | updateCOI (T delta_x, T delta_y, T delta_z) |
T | getAzimuth () const |
void | setAzimuth (T new_azimuth) |
T | getElevation () const |
void | setElevation (T new_elevation) |
T | getRadius () const |
void | setRadius (T new_radius) |
const sglVec3<T>& | getCOI () const |
void | setCOI (const sglVec3< T > &pos_coi) |
void | setCOI (T x, T y, T z) |
void | computeMatrix () |
virtual sglNode* | clone (unsigned int mode) const |
virtual void | printInfo (ostream &ostrm, const char *indent_spaces) const |
Protected Attributes | |
ModeEnum | m_mode |
sglVec3<T> | m_pos_coi |
T | m_radius |
T | m_elevation |
T | m_sin_el |
T | m_cos_el |
T | m_azimuth |
T | m_sin_az |
T | m_cos_az |
sglVec2<T> | m_delta_pos |
The user can select between three modes where any of the basic axes of the local coordinate system is considered "up". The azimuth angle rotates about this axes and can range from -pi to pi (values outside this range are wrapped around). The pitch angle rotates about the "right" vector and can range from -pi/2 to pi/2. Values outside this range will be clamped to this range. A radius of zero places the transformed coordinate system at the COI and positive values move it away from this point (a negative radius is clamped to zero).
After any changes to the variables, the user must call sglSphericalTransform::computeMatrix() to build the new transformation matrix and store it in the base class.
Example:
sglSphericalTransformf *tx_node = new sglSphericalTransformf; tx_node->setMode(sglSphericalTransform::eY_UP); // y up tx_node->setCOI(-10.f, 0.f, 0.f); // move out along -X axis tx_node->setAzimuth(M_PI*0.5f); // rotate "right" tx_node->setElevation(M_PI*0.25f); // rotate "up" tx_node->setRadius(1000.f); // move out tx_node->computeMatrix(); // compute tx matrix. tx_node->addChild(...);
Definition at line 71 of file sglSphericalTransform.hpp.
|
Used to specify which vector is "up".
Definition at line 75 of file sglSphericalTransform.hpp. |
|
default constructor: initializes all values to zero (equals identity).
|
|
virtual destructor.
Definition at line 81 of file sglSphericalTransform.hpp. |
|
Set the "up" axis.
Definition at line 87 of file sglSphericalTransform.hpp. |
|
Query the current "up" axis.
Definition at line 92 of file sglSphericalTransform.hpp. |
|
Reset this transform back to identity (all zeroes).
Reimplemented in sgluSphericalTransform. Referenced by sgluSphericalTransform::reset(). |
|
Add a delta to the current azimuth (and wrap around if necessary).
Definition at line 100 of file sglSphericalTransform.hpp. |
|
Add a delta to the current elevation (and clamp if necessary).
Definition at line 109 of file sglSphericalTransform.hpp. |
|
Add a delta to the current radius (and clamp if necessary).
Definition at line 117 of file sglSphericalTransform.hpp. |
|
Add a 3D delta vector to the current center of interest position.
Definition at line 125 of file sglSphericalTransform.hpp. |
|
Add a 3D delta to the current center of interest position.
Definition at line 135 of file sglSphericalTransform.hpp. |
|
Query the current azimuth angle.
Definition at line 143 of file sglSphericalTransform.hpp. |
|
Set the current azimuth angle.
Referenced by updateAzimuth(). |
|
Query the current elevation angle.
Definition at line 154 of file sglSphericalTransform.hpp. |
|
Set the current elevation angle.
Referenced by updateElevation(). |
|
Query the current radius.
Definition at line 165 of file sglSphericalTransform.hpp. |
|
Set the current radius.
Referenced by updateRadius(). |
|
Query the current center of interest position.
Definition at line 176 of file sglSphericalTransform.hpp. |
|
Set the current COI as an sglVec3.
Definition at line 181 of file sglSphericalTransform.hpp. |
|
Set the current COI as three scalars.
Definition at line 188 of file sglSphericalTransform.hpp. |
|
Must be called after any changes so that the new transformation matrix is computed. |
|
Make a copy of the scenegraph rooted at this node.
Reimplemented from sglTransform. |
|
Output the state of this node to the specified ostream.
Reimplemented from sglTransform. |