Simbody
3.6

This class, along with its sister class CoordinateDirection, provides convenient manipulation of the three coordinate axes via the definition of three constants XAxis, YAxis, and ZAxis each with a unique subtype and implicit conversion to the integers 0, 1, and 2 whenever necessary. Methods are provided to allow code to be written once that can be used to work with the axes in any order. More...
Classes  
class  XCoordinateAxis 
class  YCoordinateAxis 
class  ZCoordinateAxis 
Public Member Functions  
CoordinateAxis (int i)  
Explicit construction of a CoordinateAxis from a calculated integer that must be 0, 1, or 2 representing XAxis, YAxis, or ZAxis. More...  
operator int () const  
Implicit conversion of a CoordinateAxis to int 0, 1, or 2. More...  
CoordinateAxis  getNextAxis () const 
Return the "next" coordinate axis after this one: More...  
CoordinateAxis  getPreviousAxis () const 
Return the "previous" coordinate axis before this one: More...  
CoordinateAxis  getThirdAxis (const CoordinateAxis &axis2) const 
Given this coordinate axis and one other, return the missing one: More...  
bool  isXAxis () const 
Return true if this is the X axis. More...  
bool  isYAxis () const 
Return true if this is the Y axis. More...  
bool  isZAxis () const 
Return true if this is the Z axis. More...  
bool  isNextAxis (const CoordinateAxis &axis2) const 
Return true if the given axis2 is the one following this one as would be reported by getNextAxis(). More...  
bool  isPreviousAxis (const CoordinateAxis &axis2) const 
Return true if the given axis2 is the one preceding this one as would be reported by getPreviousAxis(). More...  
bool  isSameAxis (const CoordinateAxis &axis2) const 
Return true if the given axis2 is the same as this one. You can use operator==() to perform the same comparison. More...  
bool  areAllSameAxes (const CoordinateAxis &axis2, const CoordinateAxis &axis3) const 
Return true if both axis2 and axis3 are the same as this one. More...  
bool  isDifferentAxis (const CoordinateAxis &axis2) const 
Return true if the given axis2 is not the same one as this one. You can use operator!=() to perform the same comparison. More...  
bool  areAllDifferentAxes (const CoordinateAxis &axis2, const CoordinateAxis &axis3) const 
Return true if neither axis2 nor axis3 is the same as this axis nor each other; that is, (this,axis2,axis3) together cover all three axes. More...  
bool  isForwardCyclical (const CoordinateAxis &axis2) const 
Return true if the given axis2 is the one following this one in a forward cyclical direction, that is, if axis2 is the one that would be reported by getNextAxis(). More...  
bool  isReverseCyclical (const CoordinateAxis &axis2) const 
Return true if the given axis2 is the one following this one in a reverse cyclical direction, that is, if axis2 is the one that would be reported by getPreviousAxis(). More...  
int  dotProduct (const CoordinateAxis &axis2) const 
Perform a specialized dot product between this axis and axis2; returning one if they are the same axis and zero otherwise, without performing any floating point operations. More...  
int  crossProductSign (const CoordinateAxis &axis2) const 
Return the sign that would result from a cross product between this axis and axis2: zero if axis2 is the same as this axis; one if the result would be in the positive direction along the third axis; 1 if it would be in the negative direction. More...  
CoordinateAxis  crossProductAxis (const CoordinateAxis &axis2) const 
Return the coordinate axis along which the cross product of this axis and axis2 would lie: same as this if axis2 is the same as this axis (doesn't matter because the sign would be zero); otherwise, the third axis that is neither this one nor axis2. More...  
CoordinateAxis  crossProduct (const CoordinateAxis &axis2, int &sign) const 
Return the axis and sign along that axis that would result from a cross product between this axis and axis2; this combines the functions of both crossProductAxis() and crossProductSign(). More...  
Static Public Member Functions  
static const CoordinateAxis &  getCoordinateAxis (int i) 
Return a reference to the CoordinateAxis constant XAxis, YAxis, or ZAxis corresponding to the given integer index which must be 0, 1, or 2. More...  
static bool  isIndexInRange (int i) 
Return true if the given integer is suitable as a coordinate axis, meaning it is one of 0, 1, or 2 designating XAxis, YAxis, or ZAxis, respectively. More...  
Related Functions  
(Note that these are not member functions.)  
bool  operator== (const CoordinateAxis &a1, const CoordinateAxis &a2) 
Compare two CoordinateAxis objects. More...  
bool  operator!= (const CoordinateAxis &a1, const CoordinateAxis &a2) 
Compare two CoordinateAxis objects. More...  
const CoordinateDirection::NegXDirection &  operator (const CoordinateAxis::XCoordinateAxis &) 
Create the NegXAxis direction by negating XAxis. More...  
const CoordinateDirection::NegYDirection &  operator (const CoordinateAxis::YCoordinateAxis &) 
Create the NegYAxis direction by negating YAxis. More...  
const CoordinateDirection::NegZDirection &  operator (const CoordinateAxis::ZCoordinateAxis &) 
Create the NegZAxis direction by negating ZAxis. More...  
CoordinateDirection  operator (const CoordinateAxis &axis) 
Create the negative direction along the given axis. More...  
CoordinateDirection  operator+ (const CoordinateAxis &axis) 
Create the positive direction along the given axis. More...  
This class, along with its sister class CoordinateDirection, provides convenient manipulation of the three coordinate axes via the definition of three constants XAxis, YAxis, and ZAxis each with a unique subtype and implicit conversion to the integers 0, 1, and 2 whenever necessary. Methods are provided to allow code to be written once that can be used to work with the axes in any order.
There are also three CoordinateDirection constants NegXAxis, NegYAxis, and NegZAxis, also with unique types permitting efficient compile time manipulation. These do not correspond to integers, however. Instead, they are objects containing one of the CoordinateAxis objects combined with an integer that is 1 or 1 to indicate the direction along that axis. The unary negation operator is overloaded so that XAxis is NegXAxis and NegZAxis is ZAxis. There are implicit conversions to UnitVec3 for any CoordinateAxis or CoordinateDirection object, yielding the equivalent (normalized) unit vector corresponding to any of the six directions, without doing any computation (and in particular, without normalizing).

inlineexplicit 
Explicit construction of a CoordinateAxis from a calculated integer that must be 0, 1, or 2 representing XAxis, YAxis, or ZAxis.

inline 
Implicit conversion of a CoordinateAxis to int 0, 1, or 2.

inline 
Return the "next" coordinate axis after this one:

inline 
Return the "previous" coordinate axis before this one:

inline 
Given this coordinate axis and one other, return the missing one:
[in]  axis2  A coordinate axis that must be distinct from the current one; it is a fatal error to provide the same axis. 

inline 
Return true if this is the X axis.

inline 
Return true if this is the Y axis.

inline 
Return true if this is the Z axis.

inline 
Return true if the given axis2 is the one following this one as would be reported by getNextAxis().

inline 
Return true if the given axis2 is the one preceding this one as would be reported by getPreviousAxis().

inline 
Return true if the given axis2 is the same as this one. You can use operator==() to perform the same comparison.

inline 
Return true if both axis2 and axis3 are the same as this one.

inline 
Return true if the given axis2 is not the same one as this one. You can use operator!=() to perform the same comparison.

inline 
Return true if neither axis2 nor axis3 is the same as this axis nor each other; that is, (this,axis2,axis3) together cover all three axes.

inline 
Return true if the given axis2 is the one following this one in a forward cyclical direction, that is, if axis2 is the one that would be reported by getNextAxis().

inline 
Return true if the given axis2 is the one following this one in a reverse cyclical direction, that is, if axis2 is the one that would be reported by getPreviousAxis().

inline 
Perform a specialized dot product between this axis and axis2; returning one if they are the same axis and zero otherwise, without performing any floating point operations.

inline 
Return the sign that would result from a cross product between this axis and axis2: zero if axis2 is the same as this axis; one if the result would be in the positive direction along the third axis; 1 if it would be in the negative direction.
No floating point computations are performed.

inline 
Return the coordinate axis along which the cross product of this axis and axis2 would lie: same as this if axis2 is the same as this axis (doesn't matter because the sign would be zero); otherwise, the third axis that is neither this one nor axis2.
But note that the actual result may be along that axis or in the negative direction along that axis. No floating point computations are performed.

inline 
Return the axis and sign along that axis that would result from a cross product between this axis and axis2; this combines the functions of both crossProductAxis() and crossProductSign().
Note that if axis2 is the same as this axis we'll just return this as the axis but the sign is zero since the magnitude of the result would be zero. No floating point calculations are performed.

inlinestatic 
Return a reference to the CoordinateAxis constant XAxis, YAxis, or ZAxis corresponding to the given integer index which must be 0, 1, or 2.

inlinestatic 
Return true if the given integer is suitable as a coordinate axis, meaning it is one of 0, 1, or 2 designating XAxis, YAxis, or ZAxis, respectively.

related 
Compare two CoordinateAxis objects.

related 
Compare two CoordinateAxis objects.

related 
Create the NegXAxis direction by negating XAxis.
No computation is necessary.

related 
Create the NegYAxis direction by negating YAxis.
No computation is necessary.

related 
Create the NegZAxis direction by negating ZAxis.
No computation is necessary.

related 
Create the negative direction along the given axis.
No computation is necessary.

related 
Create the positive direction along the given axis.
No computation is necessary.