40template <
class P,
int S>
class UnitVec;
41template <
class P,
int S>
class UnitRow;
55template <
class P,
int S>
176 {
return *
reinterpret_cast<const UnitVec*
>(p); }
180template <
class P,
int S>
inline UnitVec<P,1>
185 const int minAxis = u[0] <= u[1] ? (u[0] <= u[2] ? 0 : 2)
186 : (u[1] <= u[2] ? 1 : 2);
193template <
class P,
int S1,
int S2>
inline bool
200template <
class P,
int S1,
int S2>
inline bool
210template <
class P,
int S>
252 { assert(0 <= axis && axis <= 2);
315 {
return *
reinterpret_cast<const UnitRow*
>(p); }
318template <
class P,
int S>
323 const int minAxis = u[0] <= u[1] ? (u[0] <= u[2] ? 0 : 2)
324 : (u[1] <= u[2] ? 1 : 2);
332template <
class P,
int S1,
int S2>
inline bool
339template <
class P,
int S1,
int S2>
inline bool
Defines the CoordinateAxis and CoordinateDirection classes.
This file is the user-includeable header to be included in user programs to provide fixed-length Vec ...
This class, along with its sister class CoordinateDirection, provides convenient manipulation of the ...
Definition CoordinateAxis.h:53
A CoordinateDirection is a CoordinateAxis plus a direction indicating the positive or negative direct...
Definition CoordinateAxis.h:244
This is a fixed-length row vector designed for no-overhead inline computation.
Definition Row.h:132
Row & operator=(const Row &src)
Definition Row.h:319
static Row< N, P, 1 > getNaN()
Return a Row of the same length and element type as this one but with all elements set to NaN.
Definition Row.h:715
CNT< ScalarNormSq >::TSqrt norm() const
Definition Row.h:456
const E & operator[](int i) const
Definition Row.h:449
const E & operator()(int i) const
Definition Row.h:451
This type is used for the transpose of UnitVec, and as the returned row type of a Rotation.
Definition UnitVec.h:211
UnitRow(const P &x, const P &y, const P &z)
Create a unit row from explicitly specified measure numbers (x,y,z); requires expensive normalization...
Definition UnitVec.h:246
UnitRow()
Definition UnitVec.h:216
UnitRow< P, 1 > negate() const
Returns a new unit vector pointing in the opposite direction from this one; does not modify this Unit...
Definition UnitVec.h:263
TransposeType & operator~()
Return a writable reference to this UnitRow reinterpreted as a UnitVec; no computation requires since...
Definition UnitVec.h:273
UnitRow & operator=(const UnitRow &u)
Copy assignment does not require normalization.
Definition UnitVec.h:228
const P & operator[](int i) const
Return one element of this unit row as a const reference; there is no corresponding writable index fu...
Definition UnitVec.h:281
UnitRow(const UnitRow< P, S2 > &u)
Implicit conversion from UnitRow with different stride; no normalization required.
Definition UnitVec.h:224
UnitRow(const Row< 3, P, S2 > &v)
Explicit conversion from Row of any stride to UnitRow, requiring expensive normalization.
Definition UnitVec.h:242
static const UnitRow & getAs(const P *p)
(Advanced) Reinterpret a given memory location as a UnitRow like this one, without checking – don't u...
Definition UnitVec.h:314
bool operator==(const UnitRow< P, S1 > &u1, const UnitRow< P, S2 > &u2)
Compare two UnitRow3 objects for exact, bitwise equality (not very useful).
Definition UnitVec.h:333
UnitRow(const BaseRow &v)
Explicit conversion from Row to UnitRow, requiring expensive normalization.
Definition UnitVec.h:238
const BaseRow & asRow3() const
Return a const reference to the Row3 underlying this UnitRow.
Definition UnitVec.h:256
UnitRow(int axis)
Create a unit axis vector 100 010 001 given 0, 1, or 2.
Definition UnitVec.h:251
UnitRow(const UnitRow &u)
Copy constructor does not require normalization.
Definition UnitVec.h:219
Row< 3, P, S > BaseRow
Definition UnitVec.h:213
UnitVec< P, S > TransposeType
Definition UnitVec.h:214
UnitRow(const Row< 3, P, S2 > &v, bool)
(Advanced) This constructor is only for our friends whom we trust to give us an already-normalized ve...
Definition UnitVec.h:307
UnitRow< P, 1 > abs() const
Return a new UnitRow whose measure numbers are the absolute values of the ones here.
Definition UnitVec.h:292
bool operator!=(const UnitRow< P, S1 > &u1, const UnitRow< P, S2 > &u2)
Compare two UnitRow3 objects and return true unless they are exactly bitwise equal (not very useful).
Definition UnitVec.h:340
UnitRow & operator=(const UnitRow< P, S2 > &u)
Copy assignment from UnitRow with different stride; no computation needed.
Definition UnitVec.h:233
const TransposeType & operator~() const
Return a const reference to this UnitRow reinterpreted as a UnitVec; no computation requires since th...
Definition UnitVec.h:270
const P & operator()(int i) const
Return one element of this unit row as a const reference; there is no corresponding writable index fu...
Definition UnitVec.h:285
UnitRow(const BaseRow &v, bool)
(Advanced) This constructor is only for our friends whom we trust to give us an already-normalized ve...
Definition UnitVec.h:302
UnitRow< P, 1 > operator-() const
Returns a new unit vector pointing in the opposite direction from this one.
Definition UnitVec.h:266
UnitRow< P, 1 > perp() const
Return a new UnitRow perpendicular to this one but otherwise arbitrary.
Definition UnitVec.h:319
This class is a Vec3 plus an ironclad guarantee either that:
Definition UnitVec.h:56
UnitRow< P, S > TransposeType
Definition UnitVec.h:59
UnitVec< P, 1 > abs() const
Return a new unit vector whose measure numbers are the absolute values of the ones here.
Definition UnitVec.h:153
const P & operator()(int i) const
Return one element of this unit vector as a const reference; there is no corresponding writable index...
Definition UnitVec.h:146
TransposeType & operator~()
Return a writable reference to this unit vector re-expressed as a unit row; no computational cost.
Definition UnitVec.h:134
UnitVec(const UnitVec &u)
Copy constructor does not require normalization since we know the source is a unit vector.
Definition UnitVec.h:67
UnitVec< P, 1 > perp() const
Return a new unit vector perpendicular to this one but otherwise arbitrary.
Definition UnitVec.h:181
UnitVec & operator=(const UnitVec< P, S2 > &u)
Copy assignment from a UnitVec whose stride differs from this one; no normalization required.
Definition UnitVec.h:112
bool operator!=(const UnitVec< P, S1 > &u1, const UnitVec< P, S2 > &u2)
Compare two UnitVec3 objects and return true unless they are exactly bitwise equal (not very useful).
Definition UnitVec.h:201
bool operator==(const UnitVec< P, S1 > &u1, const UnitVec< P, S2 > &u2)
Compare two UnitVec3 objects for exact, bitwise equality (not very useful).
Definition UnitVec.h:194
const P & operator[](int i) const
Return one element of this unit vector as a const reference; there is no corresponding writable index...
Definition UnitVec.h:142
UnitVec(const BaseVec &v, bool)
(Advanced) This constructor is only for our friends whom we trust to give us an already-normalized ve...
Definition UnitVec.h:163
UnitVec()
Default constructor initializes to all-NaN even in Release mode so that we maintain the above-promise...
Definition UnitVec.h:63
const BaseVec & asVec3() const
Return a reference to the underlying Vec3 (no copying here).
Definition UnitVec.h:117
UnitVec(const Vec< 3, P, S2 > &v, bool)
(Advanced) This constructor is only for our friends whom we trust to give us an already-normalized ve...
Definition UnitVec.h:168
UnitVec(const BaseVec &v)
Explicit conversion from Vec to UnitVec, requiring expensive normalization.
Definition UnitVec.h:76
UnitVec(const Vec< 3, P, S2 > &v)
Explicit conversion from Vec of any stride to this UnitVec, requiring expensive normalization.
Definition UnitVec.h:80
UnitVec(const UnitVec< P, S2 > &u)
Automatic conversion from UnitVec with different stride; no computation required.
Definition UnitVec.h:72
UnitVec(const CoordinateDirection &dir)
Implicit conversion from a coordinate axis direction to a UnitVec3. The axis direction is given by on...
Definition UnitVec.h:96
UnitVec< P, 1 > operator-() const
Returns a new unit vector pointing in the opposite direction from this one.
Definition UnitVec.h:127
UnitVec(int axis)
Construct a unit axis vector 100 010 001 given 0,1, or 2; this is not an implicit conversion.
Definition UnitVec.h:101
Vec< 3, P, S > BaseVec
Definition UnitVec.h:58
static const UnitVec & getAs(const P *p)
(Advanced) Reinterpret a given memory location as a UnitVec like this one, without checking – don't u...
Definition UnitVec.h:175
const TransposeType & operator~() const
Return a const reference to this unit vector re-expressed as a unit row; no computational cost.
Definition UnitVec.h:131
UnitVec & operator=(const UnitVec &u)
Copy assignment does not require normalization.
Definition UnitVec.h:106
UnitVec(const P &x, const P &y, const P &z)
Create a unit vector in the direction of the vector (x,y,z) whose measure numbers are supplied – this...
Definition UnitVec.h:85
UnitVec< P, 1 > negate() const
Returns a new unit vector pointing in the opposite direction from this one; does not modify this Unit...
Definition UnitVec.h:124
UnitVec(const CoordinateAxis &axis)
Implicit conversion from a coordinate axis XAxis, YAxis, or ZAxis to a UnitVec3. Does not require any...
Definition UnitVec.h:90
This is a fixed-length column vector designed for no-overhead inline computation.
Definition Vec.h:184
Vec & operator=(const Vec &src)
Copy assignment operator copies the logically-included elements from the source Vec; gaps due to stri...
Definition Vec.h:445
CNT< ScalarNormSq >::TSqrt norm() const
Definition Vec.h:610
static Vec< M, P, 1 > getNaN()
Return a Vec of the same length and element type as this one but with all elements set to NaN.
Definition Vec.h:915
void set(int i, const E &value)
Variant of operator[] that's scripting friendly to set ith entry.
Definition Vec.h:995
const E & operator[](int i) const
Select an element of this Vec and return a const reference to it.
Definition Vec.h:596
const E & operator()(int i) const
Same as const operator[] above.
Definition Vec.h:599
This is the top-level SimTK namespace into which all SimTK names are placed to avoid collision with o...
Definition Assembler.h:37
RowVectorBase< typename CNT< ELEM >::TAbs > abs(const RowVectorBase< ELEM > &v)
Definition VectorMath.h:120
UnitVec< double, 1 > dUnitVec3
Definition UnitVec.h:46
UnitVec< Real, 1 > UnitVec3
Definition UnitVec.h:44
UnitVec< float, 1 > fUnitVec3
Definition UnitVec.h:45