Simbody
|
A CoordinateDirection is a CoordinateAxis plus a direction indicating the positive or negative direction along that axis. More...
#include <CoordinateAxis.h>
Classes | |
class | Negative |
Use for compile-time construction of a negative CoordinateDirection along one of the coordinate axes. More... | |
class | NegXDirection |
class | NegYDirection |
class | NegZDirection |
Public Member Functions | |
CoordinateDirection (const CoordinateAxis &axis) | |
Implicit conversion of a CoordinateAxis to a positive CoordinateDirection along that axis. | |
CoordinateDirection (const CoordinateAxis &axis, Negative) | |
Explicit creation of a negative CoordinateDirection from a CoordinateAxis. | |
CoordinateDirection (const CoordinateAxis &axis, int direction) | |
Explicit creation of a CoordinateDirection from a CoordinateAxis and a direction calculated at run time. | |
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. | |
int | getDirection () const |
Returns 1 or -1 to indicate the direction along the coordinate axis returned by getAxis(). | |
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 is not the same. | |
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 axis. You can also use operator==() for this comparison. | |
int | dotProduct (const CoordinateDirection &dir2) const |
Perform a specialized dot product between this coordinate direction and dir2; returning 1 or -1 if they contain the same axis and 0 otherwise, without performing any floating point operations. | |
int | crossProductSign (const CoordinateDirection &dir2) const |
Return the sign that would result from a cross product between this coordinate direction and dir2: 0 if they are along the same axis; 1 if the result would be in the positive direction along the third axis; -1 if it would be in the negative direction. | |
CoordinateAxis | crossProductAxis (const CoordinateDirection &dir2) const |
Return the coordinate axis along which the cross product of this coordinate direction and dir2 would lie: same as this if both contain the same axis (doesn't matter because the sign would be zero); otherwise, the third axis that neither this one nor dir2 contains. | |
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 coordinate direction and dir2; this combines the functions of both crossProductAxis() and crossProductSign(). | |
Related Functions | |
(Note that these are not member functions.) | |
bool | operator== (const CoordinateDirection &d1, const CoordinateDirection &d2) |
Compare two CoordinateDirection objects. | |
bool | operator!= (const CoordinateDirection &d1, const CoordinateDirection &d2) |
Compare two CoordinateDirection objects. | |
const CoordinateAxis::XCoordinateAxis & | operator- (const CoordinateDirection::NegXDirection &) |
Create the XAxis direction by negating NegXAxis. | |
const CoordinateAxis::YCoordinateAxis & | operator- (const CoordinateDirection::NegYDirection &) |
Create the YAxis direction by negating NegYAxis. | |
const CoordinateAxis::ZCoordinateAxis & | operator- (const CoordinateDirection::NegZDirection &) |
Create the ZAxis direction by negating NegZAxis. | |
CoordinateDirection | operator- (const CoordinateDirection &dir) |
Create the opposite direction from the given direction. |
A CoordinateDirection is a CoordinateAxis plus a direction indicating the positive or negative direction along that axis.
There are only six possible values for a CoordinateDirection, and there are predefined constants available covering all of them:
SimTK::CoordinateDirection::CoordinateDirection | ( | const CoordinateAxis & | axis | ) | [inline] |
Implicit conversion of a CoordinateAxis to a positive CoordinateDirection along that axis.
SimTK::CoordinateDirection::CoordinateDirection | ( | const CoordinateAxis & | axis, |
Negative | |||
) | [inline] |
Explicit creation of a negative CoordinateDirection from a CoordinateAxis.
SimTK::CoordinateDirection::CoordinateDirection | ( | const CoordinateAxis & | axis, |
int | direction | ||
) | [inline] |
Explicit creation of a CoordinateDirection from a CoordinateAxis and a direction calculated at run time.
[in] | axis | XAxis, YAxis, or ZAxis |
[in] | direction | Must be -1 or 1. |
CoordinateAxis SimTK::CoordinateDirection::getAxis | ( | ) | const [inline] |
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.
int SimTK::CoordinateDirection::getDirection | ( | ) | const [inline] |
Returns 1 or -1 to indicate the direction along the coordinate axis returned by getAxis().
bool SimTK::CoordinateDirection::hasSameAxis | ( | const CoordinateDirection & | dir2 | ) | const [inline] |
Return true if this direction and dir2 are along the same axis, even if the direction along that axis is not the same.
bool SimTK::CoordinateDirection::isSameAxisAndDirection | ( | const CoordinateDirection & | dir2 | ) | const [inline] |
Return true if this direction and dir2 are along the same axis, and in the same direction along that axis. You can also use operator==() for this comparison.
int SimTK::CoordinateDirection::dotProduct | ( | const CoordinateDirection & | dir2 | ) | const [inline] |
Perform a specialized dot product between this coordinate direction and dir2; returning 1 or -1 if they contain the same axis and 0 otherwise, without performing any floating point operations.
int SimTK::CoordinateDirection::crossProductSign | ( | const CoordinateDirection & | dir2 | ) | const [inline] |
Return the sign that would result from a cross product between this coordinate direction and dir2: 0 if they are along the same axis; 1 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.
CoordinateAxis SimTK::CoordinateDirection::crossProductAxis | ( | const CoordinateDirection & | dir2 | ) | const [inline] |
Return the coordinate axis along which the cross product of this coordinate direction and dir2 would lie: same as this if both contain the same axis (doesn't matter because the sign would be zero); otherwise, the third axis that neither this one nor dir2 contains.
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.
CoordinateAxis SimTK::CoordinateDirection::crossProduct | ( | const CoordinateDirection & | dir2, |
int & | sign | ||
) | const [inline] |
Return the axis and sign along that axis that would result from a cross product between this coordinate direction and dir2; this combines the functions of both crossProductAxis() and crossProductSign().
Note that if dir2 is along the same axis as this one, 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.
bool operator== | ( | const CoordinateDirection & | d1, |
const CoordinateDirection & | d2 | ||
) | [related] |
Compare two CoordinateDirection objects.
bool operator!= | ( | const CoordinateDirection & | d1, |
const CoordinateDirection & | d2 | ||
) | [related] |
Compare two CoordinateDirection objects.
const CoordinateAxis::XCoordinateAxis & operator- | ( | const CoordinateDirection::NegXDirection & | ) | [related] |
Create the XAxis direction by negating NegXAxis.
No computation is necessary.
const CoordinateAxis::YCoordinateAxis & operator- | ( | const CoordinateDirection::NegYDirection & | ) | [related] |
Create the YAxis direction by negating NegYAxis.
No computation is necessary.
const CoordinateAxis::ZCoordinateAxis & operator- | ( | const CoordinateDirection::NegZDirection & | ) | [related] |
Create the ZAxis direction by negating NegZAxis.
No computation is necessary.
CoordinateDirection operator- | ( | const CoordinateDirection & | dir | ) | [related] |
Create the opposite direction from the given direction.
No computation is necessary.