A CoordinateDirection is a CoordinateAxis plus a direction indicating the positive or negative direction along that axis.
More...
#include <CoordinateAxis.h>
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:
- XAxis, YAxis, ZAxis are the CoordinateAxis types; they will implicitly convert to positive axis directions.
- NegXAxis, NegYAxis, NegZAxis are the negative directions.
- The unary negation operator is overloaded so that -XAxis produces NegXAxis and -NegYAxis produces YAxis.
- The unary plus operator is overloaded for the CoordinateAxis objects so that +XAxis and so on are the positive CoordinateDirection objects. You can also produce CoordinateDirections at compile time or run time from calculated axes and directions.
- See also
- CoordinateAxis
◆ CoordinateDirection() [1/3]
SimTK::CoordinateDirection::CoordinateDirection |
( |
const CoordinateAxis & |
axis | ) |
|
|
inline |
◆ CoordinateDirection() [2/3]
◆ CoordinateDirection() [3/3]
SimTK::CoordinateDirection::CoordinateDirection |
( |
const CoordinateAxis & |
axis, |
|
|
int |
direction |
|
) |
| |
|
inline |
Explicit creation of a CoordinateDirection from a CoordinateAxis and a direction calculated at run time.
- Parameters
-
[in] | axis | XAxis, YAxis, or ZAxis |
[in] | direction | Must be -1 or 1. |
- Note
- Zero is not allowed for direction, meaning that you must not try to produce one of these from the "sign" result of one of the cross product methods, because there the sign can be -1, 0, or 1.
◆ getAxis()
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.
◆ getDirection()
int SimTK::CoordinateDirection::getDirection |
( |
| ) |
const |
|
inline |
Returns 1 or -1 to indicate the direction along the coordinate axis returned by getAxis().
◆ hasSameAxis()
Return true if this direction and dir2 are along the same axis, even if the direction along that axis is not the same.
◆ isSameAxisAndDirection()
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.
◆ dotProduct()
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.
◆ crossProductSign()
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.
- See also
- crossProductAxis()
◆ crossProductAxis()
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.
- See also
- crossProductSign().
◆ crossProduct()
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.
- See also
- crossProductSign(), crossProductAxis()
◆ operator==()
◆ operator!=()
◆ operator-() [1/4]
Create the XAxis direction by negating NegXAxis.
No computation is necessary.
◆ operator-() [2/4]
Create the YAxis direction by negating NegYAxis.
No computation is necessary.
◆ operator-() [3/4]
Create the ZAxis direction by negating NegZAxis.
No computation is necessary.
◆ operator-() [4/4]
Create the opposite direction from the given direction.
No computation is necessary.
The documentation for this class was generated from the following file: