Support Forum G3D Web Page |
Azimuth measured in degrees from 0 = North = -z, increasing clockwise in the ZX plane. More...
Public Member Functions | |
CompassDirection (const Any &a) | |
CompassDirection (float degrees=0) | |
Initialize from a compass reading. More... | |
CompassDirection | clockwise90Degrees () const |
Synonym for right90Degrees() More... | |
CompassDirection | counterclockwise90Degrees () const |
Synonym for left90Degrees() More... | |
CompassDirection | left90Degrees () const |
const String & | nearestCompassPointAbbreviation () const |
const String & | nearestCompassPointName () const |
Compounded cardinal and ordinal description, e.g., "Southwest by South". More... | |
operator Vector3 () const | |
Return a vector in the XZ plane pointing along this compass direction. More... | |
bool | operator!= (CompassDirection c) const |
True if these are not the same direction modulo 360 degrees. More... | |
CompassDirection & | operator+= (CompassDelta d) |
CompassDirection | operator- () const |
Points in the opposite direction. More... | |
CompassDelta | operator- (CompassDirection other) const |
Returns the angle measure of the arc from this to other, going the shorter way around the circle (e.g., -45 instead of +135). More... | |
CompassDirection & | operator-= (CompassDelta d) |
bool | operator== (CompassDirection c) const |
True if these are the same direction modulo 360 degrees. More... | |
CompassDirection | port90Degrees () const |
Synonym for left90Degrees() More... | |
CompassDirection | right90Degrees () const |
CompassDirection | starboard90Degrees () const |
Synonym for right90Degrees() More... | |
Any | toAny () const |
Matrix3 | toHeadingMatrix3 () const |
Rotation matrix to produce this compass direction as a heading for an object that normally faces along its -z axis. More... | |
float | value () const |
Always returns a number on the interval [0, 360) More... | |
float | zxRadians () const |
Returns the angle in radians in the ZX plane, measured counter-clockwise from the Z axis. More... | |
Static Public Member Functions | |
static CompassDirection | east () |
static CompassDirection | north () |
static CompassDirection | south () |
static CompassDirection | west () |
Protected Attributes | |
float | m_angleDegrees |
Azimuth measured in degrees from 0 = North = -z, increasing clockwise in the ZX plane.
Because the standard compass conventions are very different from G3D (and most 3D) conventions, this class helps avoid errors when modeling simulations that naturally use compass directions (e.g., boats and planes).
This class does not model differences between true North and magnetic North, or between heading and course.
To avoid ambiguity, no comparison operators (beyond equality) are provided. Use a CompassDelta if you wish to compare directions.
The internal storage is in floating point degrees, so all small integers are exactly represented.
G3D::CompassDirection::CompassDirection | ( | const Any & | a | ) |
Referenced by east(), left90Degrees(), north(), operator-(), right90Degrees(), south(), and west().
|
inlineexplicit |
Initialize from a compass reading.
|
inline |
Synonym for right90Degrees()
|
inline |
Synonym for left90Degrees()
|
inlinestatic |
|
inline |
Referenced by counterclockwise90Degrees(), and port90Degrees().
const String& G3D::CompassDirection::nearestCompassPointAbbreviation | ( | ) | const |
const String& G3D::CompassDirection::nearestCompassPointName | ( | ) | const |
Compounded cardinal and ordinal description, e.g., "Southwest by South".
|
inlinestatic |
G3D::CompassDirection::operator Vector3 | ( | ) | const |
Return a vector in the XZ plane pointing along this compass direction.
|
inline |
True if these are not the same direction modulo 360 degrees.
|
inline |
|
inline |
Points in the opposite direction.
|
inline |
Returns the angle measure of the arc from this to other, going the shorter way around the circle (e.g., -45 instead of +135).
|
inline |
|
inline |
True if these are the same direction modulo 360 degrees.
|
inline |
Synonym for left90Degrees()
|
inline |
Referenced by clockwise90Degrees(), and starboard90Degrees().
|
inlinestatic |
|
inline |
Synonym for right90Degrees()
Any G3D::CompassDirection::toAny | ( | ) | const |
Matrix3 G3D::CompassDirection::toHeadingMatrix3 | ( | ) | const |
Rotation matrix to produce this compass direction as a heading for an object that normally faces along its -z axis.
|
inline |
Always returns a number on the interval [0, 360)
Referenced by operator!=(), and operator==().
|
inlinestatic |
|
inline |
|
protected |
Referenced by left90Degrees(), operator+=(), operator-(), operator-=(), right90Degrees(), value(), and zxRadians().