1 #ifndef SimTK_SimTKCOMMON_COORDINATE_AXIS_H_ 2 #define SimTK_SimTKCOMMON_COORDINATE_AXIS_H_ 61 operator int()
const {
return m_myAxisId;}
91 bool isXAxis()
const {
return m_myAxisId == 0;}
93 bool isYAxis()
const {
return m_myAxisId == 1;}
95 bool isZAxis()
const {
return m_myAxisId == 2;}
107 {
return m_myAxisId == int(axis2); }
115 {
return m_myAxisId != int(axis2); }
176 class XCoordinateAxis;
class YCoordinateAxis;
class ZCoordinateAxis;
216 return (i==0 ? static_cast<const CoordinateAxis&>(
XAxis)
217 : (i==1 ? static_cast<const CoordinateAxis&>(
YAxis)
218 : static_cast<const CoordinateAxis&>(
ZAxis)));
253 : m_axis(axis), m_direction(1) {}
258 : m_axis(axis), m_direction(-1) {}
268 : m_axis(axis), m_direction(direction)
269 { assert(direction==1 || direction==-1); }
294 {
if (m_axis != dir2.
getAxis())
return 0;
303 {
if (m_axis == dir2.
getAxis())
return 0;
329 class NegXDirection;
class NegYDirection;
class NegZDirection;
412 #endif // SimTK_SimTKCOMMON_COORDINATE_AXIS_H_ CoordinateAxis crossProduct(const CoordinateDirection &dir2, int &sign) const
Return the axis and sign along that axis that would result from a cross product between this coordina...
Definition: CoordinateAxis.h:324
int dotProduct(const CoordinateDirection &dir2) const
Perform a specialized dot product between this coordinate direction and dir2; returning 1 or -1 if th...
Definition: CoordinateAxis.h:293
const CoordinateDirection::NegZDirection NegZAxis
Global constant indicating -Z coordinate direction.
#define SimTK_SimTKCOMMON_EXPORT
Definition: SimTKcommon/include/SimTKcommon/internal/common.h:224
NegZDirection()
Definition: CoordinateAxis.h:345
const CoordinateAxis::YCoordinateAxis & operator-(const CoordinateDirection::NegYDirection &)
Create the YAxis direction by negating NegYAxis.
Definition: CoordinateAxis.h:398
CoordinateAxis crossProductAxis(const CoordinateDirection &dir2) const
Return the coordinate axis along which the cross product of this coordinate direction and dir2 would ...
Definition: CoordinateAxis.h:314
CoordinateDirection operator-(const CoordinateDirection &dir)
Create the opposite direction from the given direction.
Definition: CoordinateAxis.h:407
const CoordinateDirection::NegXDirection NegXAxis
Global constant indicating -X coordinate direction.
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 ...
Definition: CoordinateAxis.h:106
YCoordinateAxis()
Definition: CoordinateAxis.h:198
This is the top-level SimTK namespace into which all SimTK names are placed to avoid collision with o...
Definition: Assembler.h:37
static const CoordinateAxis & getCoordinateAxis(int i)
Return a reference to the CoordinateAxis constant XAxis, YAxis, or ZAxis corresponding to the given i...
Definition: CoordinateAxis.h:214
bool operator!=(const CoordinateDirection &d1, const CoordinateDirection &d2)
Compare two CoordinateDirection objects.
Definition: CoordinateAxis.h:362
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 t...
Definition: CoordinateAxis.h:114
Definition: CoordinateAxis.h:194
A CoordinateDirection is a CoordinateAxis plus a direction indicating the positive or negative direct...
Definition: CoordinateAxis.h:244
Definition: CoordinateAxis.h:197
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...
Definition: CoordinateAxis.h:163
Definition: CoordinateAxis.h:200
CoordinateAxis getAxis() const
This is the coordinate axis XAxis, YAxis, or ZAxis contained in this CoordinateDirection. Use getDirection() to determine whether this is the positive or negative direction.
Definition: CoordinateAxis.h:274
bool hasSameAxis(const CoordinateDirection &dir2) const
Return true if this direction and dir2 are along the same axis, even if the direction along that axis...
Definition: CoordinateAxis.h:281
XCoordinateAxis()
Definition: CoordinateAxis.h:195
const CoordinateAxis::ZCoordinateAxis ZAxis
Constant representing the Z coordinate axis; will implicitly convert to the integer 2 when used in a ...
This class, along with its sister class CoordinateDirection, provides convenient manipulation of the ...
Definition: CoordinateAxis.h:53
CoordinateDirection(const CoordinateAxis &axis, int direction)
Explicit creation of a CoordinateDirection from a CoordinateAxis and a direction calculated at run ti...
Definition: CoordinateAxis.h:267
const CoordinateDirection::NegYDirection NegYAxis
Global constant indicating -Y coordinate direction.
bool areAllSameAxes(const CoordinateAxis &axis2, const CoordinateAxis &axis3) const
Return true if both axis2 and axis3 are the same as this one.
Definition: CoordinateAxis.h:109
static bool isIndexInRange(int i)
Return true if the given integer is suitable as a coordinate axis, meaning it is one of 0...
Definition: CoordinateAxis.h:173
bool isReverseCyclical(const CoordinateAxis &axis2) const
Return true if the given axis2 is the one following this one in a reverse cyclical direction...
Definition: CoordinateAxis.h:131
CoordinateAxis getThirdAxis(const CoordinateAxis &axis2) const
Given this coordinate axis and one other, return the missing one:
Definition: CoordinateAxis.h:84
const CoordinateAxis::YCoordinateAxis YAxis
Constant representing the Y coordinate axis; will implicitly convert to the integer 1 when used in a ...
bool operator==(const CoordinateAxis &a1, const CoordinateAxis &a2)
Compare two CoordinateAxis objects.
Definition: CoordinateAxis.h:222
int getDirection() const
Returns 1 or -1 to indicate the direction along the coordinate axis returned by getAxis().
Definition: CoordinateAxis.h:277
CoordinateAxis(int i)
Explicit construction of a CoordinateAxis from a calculated integer that must be 0, 1, or 2 representing XAxis, YAxis, or ZAxis.
Definition: CoordinateAxis.h:57
const CoordinateAxis::ZCoordinateAxis & operator-(const CoordinateDirection::NegZDirection &)
Create the ZAxis direction by negating NegZAxis.
Definition: CoordinateAxis.h:402
bool isYAxis() const
Return true if this is the Y axis.
Definition: CoordinateAxis.h:93
CoordinateDirection(const CoordinateAxis &axis)
Implicit conversion of a CoordinateAxis to a positive CoordinateDirection along that axis...
Definition: CoordinateAxis.h:252
bool isPreviousAxis(const CoordinateAxis &axis2) const
Return true if the given axis2 is the one preceding this one as would be reported by getPreviousAxis(...
Definition: CoordinateAxis.h:102
const CoordinateDirection::NegYDirection & operator-(const CoordinateAxis::YCoordinateAxis &)
Create the NegYAxis direction by negating YAxis.
Definition: CoordinateAxis.h:373
Use for compile-time construction of a negative CoordinateDirection along one of the coordinate axes...
Definition: CoordinateAxis.h:248
CoordinateDirection operator-(const CoordinateAxis &axis)
Create the negative direction along the given axis.
Definition: CoordinateAxis.h:382
bool operator==(const CoordinateDirection &d1, const CoordinateDirection &d2)
Compare two CoordinateDirection objects.
Definition: CoordinateAxis.h:357
bool isNextAxis(const CoordinateAxis &axis2) const
Return true if the given axis2 is the one following this one as would be reported by getNextAxis()...
Definition: CoordinateAxis.h:98
CoordinateAxis getPreviousAxis() const
Return the "previous" coordinate axis before this one:
Definition: CoordinateAxis.h:74
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 ...
Definition: CoordinateAxis.h:144
bool isXAxis() const
Return true if this is the X axis.
Definition: CoordinateAxis.h:91
Mandatory first inclusion for any Simbody source or header file.
ZCoordinateAxis()
Definition: CoordinateAxis.h:201
CoordinateDirection(const CoordinateAxis &axis, Negative)
Explicit creation of a negative CoordinateDirection from a CoordinateAxis.
Definition: CoordinateAxis.h:257
CoordinateAxis crossProductAxis(const CoordinateAxis &axis2) const
Return the coordinate axis along which the cross product of this axis and axis2 would lie: same as th...
Definition: CoordinateAxis.h:153
unsigned int sign(unsigned char u)
Definition: Scalar.h:311
const CoordinateAxis::XCoordinateAxis & operator-(const CoordinateDirection::NegXDirection &)
Create the XAxis direction by negating NegXAxis.
Definition: CoordinateAxis.h:394
int dotProduct(const CoordinateAxis &axis2) const
Perform a specialized dot product between this axis and axis2; returning one if they are the same axi...
Definition: CoordinateAxis.h:137
const CoordinateDirection::NegZDirection & operator-(const CoordinateAxis::ZCoordinateAxis &)
Create the NegZAxis direction by negating ZAxis.
Definition: CoordinateAxis.h:377
CoordinateDirection operator+(const CoordinateAxis &axis)
Create the positive direction along the given axis.
Definition: CoordinateAxis.h:388
bool isZAxis() const
Return true if this is the Z axis.
Definition: CoordinateAxis.h:95
NegXDirection()
Definition: CoordinateAxis.h:339
CoordinateAxis getNextAxis() const
Return the "next" coordinate axis after this one:
Definition: CoordinateAxis.h:67
const CoordinateDirection::NegXDirection & operator-(const CoordinateAxis::XCoordinateAxis &)
Create the NegXAxis direction by negating XAxis.
Definition: CoordinateAxis.h:369
NegYDirection()
Definition: CoordinateAxis.h:342
bool isForwardCyclical(const CoordinateAxis &axis2) const
Return true if the given axis2 is the one following this one in a forward cyclical direction...
Definition: CoordinateAxis.h:126
Definition: CoordinateAxis.h:344
bool operator!=(const CoordinateAxis &a1, const CoordinateAxis &a2)
Compare two CoordinateAxis objects.
Definition: CoordinateAxis.h:226
bool isSameAxisAndDirection(const CoordinateDirection &dir2) const
Return true if this direction and dir2 are along the same axis, and in the same direction along that ...
Definition: CoordinateAxis.h:287
Definition: CoordinateAxis.h:341
int crossProductSign(const CoordinateDirection &dir2) const
Return the sign that would result from a cross product between this coordinate direction and dir2: 0 ...
Definition: CoordinateAxis.h:302
Definition: CoordinateAxis.h:338
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...
Definition: CoordinateAxis.h:119
const CoordinateAxis::XCoordinateAxis XAxis
Constant representing the X coordinate axis; will implicitly convert to the integer 0 when used in a ...