22 #ifndef INCLUDED_numeric_xyzTriple_hh
23 #define INCLUDED_numeric_xyzTriple_hh
42 template<
typename T >
95 template<
typename U >
131 template<
typename U >
165 template<
typename U >
179 template<
typename U >
192 template<
typename U >
205 template<
typename U >
219 template<
typename U >
233 template<
typename U >
247 template<
typename U >
310 assert( t !=
Value( 0 ) );
405 return xyzTriple( a.x_ + b.x_, a.y_ + b.y_, a.z_ + b.z_ );
415 return xyzTriple( v.x_ + t, v.y_ + t, v.z_ + t );
425 return xyzTriple( t + v.x_, t + v.y_, t + v.z_ );
435 return xyzTriple( a.x_ - b.x_, a.y_ - b.y_, a.z_ - b.z_ );
445 return xyzTriple( v.x_ - t, v.y_ - t, v.z_ - t );
455 return xyzTriple( t - v.x_, t - v.y_, t - v.z_ );
465 return xyzTriple( v.x_ * t, v.y_ * t, v.z_ * t );
475 return xyzTriple( t * v.x_, t * v.y_, t * v.z_ );
485 assert( t !=
Value( 0 ) );
487 return xyzTriple( v.x_ * inv_t, v.y_ * inv_t, v.z_ * inv_t );
593 assert( t !=
Value( 0 ) );
606 x_ = (
x_ <= v.x_ ?
x_ : v.x_ );
607 y_ = (
y_ <= v.y_ ?
y_ : v.y_ );
608 z_ = (
z_ <= v.z_ ?
z_ : v.z_ );
618 x_ = (
x_ >= v.x_ ?
x_ : v.x_ );
619 y_ = (
y_ >= v.y_ ?
y_ : v.y_ );
620 z_ = (
z_ >= v.z_ ?
z_ : v.z_ );
632 ( a.x_ <= b.x_ ? a.x_ : b.x_ ),
633 ( a.y_ <= b.y_ ? a.y_ : b.y_ ),
634 ( a.z_ <= b.z_ ? a.z_ : b.z_ )
646 ( a.x_ >= b.x_ ? a.x_ : b.x_ ),
647 ( a.y_ >= b.y_ ? a.y_ : b.y_ ),
648 ( a.z_ >= b.z_ ? a.z_ : b.z_ )
659 assert( length_ !=
Value ( 0 ) );
660 Value const inv_length(
Value( 1 ) / length_ );
674 assert( length_ !=
Value ( 0 ) );
675 Value const inv_length(
Value( 1 ) / length_ );
676 a.x_ =
x_ * inv_length;
677 a.y_ =
y_ * inv_length;
678 a.z_ =
z_ * inv_length;
688 if ( length_ >
Value( 0 ) ) {
689 Value const inv_length(
Value( 1 ) / length_ );
708 if ( length_ >
Value( 0 ) ) {
709 Value const inv_length(
Value( 1 ) / length_ );
710 a.x_ =
x_ * inv_length;
711 a.y_ =
y_ * inv_length;
712 a.z_ =
z_ * inv_length;
727 if ( length_ >
Value( 0 ) ) {
728 Value const inv_length(
Value( 1 ) / length_ );
747 if ( length_ >
Value( 0 ) ) {
748 Value const inv_length(
Value( 1 ) / length_ );
749 a.x_ =
x_ * inv_length;
750 a.y_ =
y_ * inv_length;
751 a.z_ =
z_ * inv_length;
766 assert( length_ !=
Value ( 0 ) );
767 Value const dilation = length_a / length_;
781 assert( length_ !=
Value ( 0 ) );
782 Value const dilation = length_a / length_;
783 a.x_ =
x_ * dilation;
784 a.y_ =
y_ * dilation;
785 a.z_ =
z_ * dilation;
795 if ( length_ >
Value( 0 ) ) {
796 Value const dilation = length_a / length_;
815 if ( length_ >
Value( 0 ) ) {
816 Value const dilation = length_a / length_;
817 a.x_ =
x_ * dilation;
818 a.y_ =
y_ * dilation;
819 a.z_ =
z_ * dilation;
834 if ( length_ >
Value( 0 ) ) {
835 Value const dilation = length_a / length_;
854 if ( length_ >
Value( 0 ) ) {
855 Value const dilation = length_a / length_;
856 a.x_ =
x_ * dilation;
857 a.y_ =
y_ * dilation;
858 a.z_ =
z_ * dilation;
873 assert( length_ !=
Value ( 0 ) );
874 Value const inv_length(
Value( 1 ) / length_ );
885 if ( length_ >
Value( 0 ) ) {
886 Value const inv_length(
Value( 1 ) / length_ );
900 if ( length_ >
Value( 0 ) ) {
901 Value const inv_length(
Value( 1 ) / length_ );
915 assert( length_ !=
Value ( 0 ) );
916 Value const dilation = length_a / length_;
927 if ( length_ >
Value( 0 ) ) {
928 Value const dilation = length_a / length_;
942 if ( length_ >
Value( 0 ) ) {
943 Value const dilation = length_a / length_;
958 assert( v.length_squared() !=
Value( 0 ) );
959 Value const c =
dot( v ) / v.length_squared();
974 assert( v.length_squared() !=
Value( 0 ) );
975 Value const c =
dot( v ) / v.length_squared();
976 return xyzTriple(
x_ - ( c * v.x_ ),
y_ - ( c * v.y_ ),
z_ - ( c * v.z_ ) );
987 assert( v.length_squared() !=
Value( 0 ) );
988 Value const c =
dot( v ) / v.length_squared();
989 a.x_ =
x_ - ( c * v.x_ );
990 a.y_ =
y_ - ( c * v.y_ );
991 a.z_ =
z_ - ( c * v.z_ );
1002 assert( v.length_squared() !=
Value( 0 ) );
1003 Value const c =
dot( v ) / v.length_squared();
1018 assert( v.length_squared() !=
Value( 0 ) );
1019 Value const c =
dot( v ) / v.length_squared();
1020 return xyzTriple( c * v.x_, c * v.y_, c * v.z_ );
1031 assert( v.length_squared() !=
Value( 0 ) );
1032 Value const c =
dot( v ) / v.length_squared();
1054 return std::sqrt(
square( a.x_ - b.x_ ) +
square( a.y_ - b.y_ ) +
square( a.z_ - b.z_ ) );
1082 return (
x_ * v.x_ ) + (
y_ * v.y_ ) + (
z_ * v.z_ );
1091 return (
x_ * v.x_ ) + (
y_ * v.y_ ) + (
z_ * v.z_ );
1100 return (
x_ * v.x_ ) + (
y_ * v.y_ ) + (
z_ * v.z_ );
1110 return ( a.x_ * b.x_ ) + ( a.y_ * b.y_ ) + ( a.z_ * b.z_ );
1120 return ( a.x_ * b.x_ ) + ( a.y_ * b.y_ ) + ( a.z_ * b.z_ );
1130 return ( a.x_ * b.x_ ) + ( a.y_ * b.y_ ) + ( a.z_ * b.z_ );
1140 (
y_ * v.z_ ) - (
z_ * v.y_ ),
1141 (
z_ * v.x_ ) - (
x_ * v.z_ ),
1142 (
x_ * v.y_ ) - (
y_ * v.x_ )
1153 (
y_ * v.z_ ) - (
z_ * v.y_ ),
1154 (
z_ * v.x_ ) - (
x_ * v.z_ ),
1155 (
x_ * v.y_ ) - (
y_ * v.x_ )
1167 ( a.y_ * b.z_ ) - ( a.z_ * b.y_ ),
1168 ( a.z_ * b.x_ ) - ( a.x_ * b.z_ ),
1169 ( a.x_ * b.y_ ) - ( a.y_ * b.x_ )
1181 ( a.y_ * b.z_ ) - ( a.z_ * b.y_ ),
1182 ( a.z_ * b.x_ ) - ( a.x_ * b.z_ ),
1183 ( a.x_ * b.y_ ) - ( a.y_ * b.x_ )
1194 c.x_ = ( a.y_ * b.z_ ) - ( a.z_ * b.y_ );
1195 c.y_ = ( a.z_ * b.x_ ) - ( a.x_ * b.z_ );
1196 c.z_ = ( a.x_ * b.y_ ) - ( a.y_ * b.x_ );
1206 c.x_ = ( a.y_ * b.z_ ) - ( a.z_ * b.y_ );
1207 c.y_ = ( a.z_ * b.x_ ) - ( a.x_ * b.z_ );
1208 c.z_ = ( a.x_ * b.y_ ) - ( a.y_ * b.x_ );
1219 Value( 0.5 * ( a.x_ + b.x_ ) ),
1220 Value( 0.5 * ( a.y_ + b.y_ ) ),
1221 Value( 0.5 * ( a.z_ + b.z_ ) )
1232 m.x_ =
Value( 0.5 * ( a.x_ + b.x_ ) );
1233 m.y_ =
Value( 0.5 * ( a.y_ + b.y_ ) );
1234 m.z_ =
Value( 0.5 * ( a.z_ + b.z_ ) );
1245 Value( 0.5 * ( a.x_ + b.x_ ) ),
1246 Value( 0.5 * ( a.y_ + b.y_ ) ),
1247 Value( 0.5 * ( a.z_ + b.z_ ) )
1258 m.x_ =
Value( 0.5 * ( a.x_ + b.x_ ) );
1259 m.y_ =
Value( 0.5 * ( a.y_ + b.y_ ) );
1260 m.z_ =
Value( 0.5 * ( a.z_ + b.z_ ) );
1270 long double const third( 1.0 / 3.0 );
1272 Value( third * ( a.x_ + b.x_ + c.x_ ) ),
1273 Value( third * ( a.y_ + b.y_ + c.y_ ) ),
1274 Value( third * ( a.z_ + b.z_ + c.z_ ) )
1285 long double const third( 1.0 / 3.0 );
1286 m.x_ =
Value( third * ( a.x_ + b.x_ + c.x_ ) );
1287 m.y_ =
Value( third * ( a.y_ + b.y_ + c.y_ ) );
1288 m.z_ =
Value( third * ( a.z_ + b.z_ + c.z_ ) );
1299 Value( 0.25 * ( a.x_ + b.x_ + c.x_ + d.x_ ) ),
1300 Value( 0.25 * ( a.y_ + b.y_ + c.y_ + d.y_ ) ),
1301 Value( 0.25 * ( a.z_ + b.z_ + c.z_ + d.z_ ) )
1312 m.x_ =
Value( 0.25 * ( a.x_ + b.x_ + c.x_ + d.x_ ) );
1313 m.y_ =
Value( 0.25 * ( a.y_ + b.y_ + c.y_ + d.y_ ) );
1314 m.z_ =
Value( 0.25 * ( a.z_ + b.z_ + c.z_ + d.z_ ) );
1324 Value const mag = a.length() * b.length();
1347 Value const mag = a.length() * b.length();
1360 return cos_of( a - b, c - b );
1382 return sin_of( a - b, c - b );
1394 static Value const ZERO( 0 );
1395 return (
x_ == ZERO ) && (
y_ == ZERO ) && (
z_ == ZERO );
1415 return ( ( length_sq >=
Value( 1 ) - tol_sq ) && ( length_sq <=
Value( 1 ) + tol_sq ) );
1435 return ( ( length_sq >=
Value( 1 ) - tol_sq ) && ( length_sq <=
Value( 1 ) + tol_sq ) );
1501 return std::sqrt( (
x_ *
x_ ) + (
y_ *
y_ ) + (
z_ *
z_ ) );
1519 return std::sqrt( (
x_ *
x_ ) + (
y_ *
y_ ) + (
z_ *
z_ ) );
1537 return std::sqrt( (
x_ *
x_ ) + (
y_ *
y_ ) + (
z_ *
z_ ) );
1587 if ( !((i >= 0) && (i < 3)) ) {
1588 throw std::out_of_range(
"numeric::xyzTriple::at");
1591 return ( i == 0 ?
x_ : ( i == 1 ?
y_ :
z_ ) );
1599 if ( !((i >= 0) && (i < 3)) ) {
1600 throw std::out_of_range (
"numeric::xyzTriple::at");
1603 return ( i == 0 ?
x_ : ( i == 1 ?
y_ :
z_ ) );
1611 assert( ( i >= 0 ) && ( i < 3 ) );
1612 return ( i == 0 ?
x_ : ( i == 1 ?
y_ :
z_ ) );
1621 assert( ( i >= 0 ) && ( i < 3 ) );
1622 return ( i == 0 ?
x_ : ( i == 1 ?
y_ :
z_ ) );
1631 assert( ( i > 0 ) && ( i <= 3 ) );
1632 return ( i == 1 ?
x_ : ( i == 2 ?
y_ :
z_ ) );
1641 assert( ( i > 0 ) && ( i <= 3 ) );
1642 return ( i == 1 ?
x_ : ( i == 2 ?
y_ :
z_ ) );
1655 return ( a.x_ == b.x_ ) && ( a.y_ == b.y_ ) && ( a.z_ == b.z_ );
1665 return ( a.x_ != b.x_ ) || ( a.y_ != b.y_ ) || ( a.z_ != b.z_ );
1676 ( a.x_ < b.x_ ?
true :
1677 ( b.x_ < a.x_ ?
false :
1678 ( a.y_ < b.y_ ?
true :
1679 ( b.y_ < a.y_ ?
false :
1680 ( a.z_ < b.z_ ) ) ) ) ) );
1691 ( a.x_ < b.x_ ?
true :
1692 ( b.x_ < a.x_ ?
false :
1693 ( a.y_ < b.y_ ?
true :
1694 ( b.y_ < a.y_ ?
false :
1695 ( a.z_ <= b.z_ ) ) ) ) ) );
1706 ( a.x_ > b.x_ ?
true :
1707 ( b.x_ > a.x_ ?
false :
1708 ( a.y_ > b.y_ ?
true :
1709 ( b.y_ > a.y_ ?
false :
1710 ( a.z_ >= b.z_ ) ) ) ) ) );
1721 ( a.x_ > b.x_ ?
true :
1722 ( b.x_ > a.x_ ?
false :
1723 ( a.y_ > b.y_ ?
true :
1724 ( b.y_ > a.y_ ?
false :
1725 ( a.z_ > b.z_ ) ) ) ) ) );
1735 return ( v.x_ == t ) && ( v.y_ == t ) && ( v.z_ == t );
1745 return ( v.x_ != t ) || ( v.y_ != t ) || ( v.z_ != t );
1755 return ( v.x_ < t ) && ( v.y_ < t ) && ( v.z_ < t );
1765 return ( v.x_ <= t ) && ( v.y_ <= t ) && ( v.z_ <= t );
1775 return ( v.x_ >= t ) && ( v.y_ >= t ) && ( v.z_ >= t );
1785 return ( v.x_ > t ) && ( v.y_ > t ) && ( v.z_ > t );
1795 return ( t == v.x_ ) && ( t == v.y_ ) && ( t == v.z_ );
1805 return ( t != v.x_ ) || ( t != v.y_ ) || ( t != v.z_ );
1815 return ( t < v.x_ ) && ( t < v.y_ ) && ( t < v.z_ );
1825 return ( t <= v.x_ ) && ( t <= v.y_ ) && ( t <= v.z_ );
1835 return ( t >= v.x_ ) && ( t >= v.y_ ) && ( t >= v.z_ );
1845 return ( t > v.x_ ) && ( t > v.y_ ) && ( t > v.z_ );
1864 return ( a.length_squared() == b.length_squared() );
1883 return ( a.length_squared() != b.length_squared() );
1949 template<
typename T >
1955 template<
typename T >
1961 template<
typename T >
1967 template<
typename T >
1973 template<
typename T >
1979 template<
typename T >
1985 template<
typename T >
1991 template<
typename T >
1997 template<
typename T >
2003 template<
typename T >
2009 template<
typename T >
2015 template<
typename T >
2021 template<
typename T >
2027 template<
typename T >
2033 template<
typename T >
2039 template<
typename T >
2045 template<
typename T >
2051 template<
typename T >
2057 template<
typename T >
2063 template<
typename T >
2069 template<
typename T >
2075 template<
typename T >
2081 template<
typename T >
2087 template<
typename T >
2093 template<
typename T >
2099 template<
typename T >
2105 template<
typename T >
2111 template<
typename T >
2117 template<
typename T >
2123 template<
typename T >
2129 template<
typename T >
2135 template<
typename T >
2141 template<
typename T >
2147 template<
typename T >
2153 template<
typename T >
2159 template<
typename T >
2165 template<
typename T >
2171 template<
typename T >
2177 template<
typename T >
2183 template<
typename T >
2189 template<
typename T >
2195 template<
typename T >
2201 template<
typename T >
2207 template<
typename T >
2213 template<
typename T >
2219 template<
typename T >
2225 template<
typename T >
2231 template<
typename T >
2237 template<
typename T >
2243 template<
typename T >
2249 template<
typename T >
2255 template<
typename T >
2257 operator <( xyzTriple< T >
const &
v,
T const & t );
2261 template<
typename T >
2263 operator <=( xyzTriple< T >
const &
v,
T const & t );
2267 template<
typename T >
2273 template<
typename T >
2279 template<
typename T >
2285 template<
typename T >
2291 template<
typename T >
2293 operator <( T const & t, xyzTriple< T >
const &
v );
2297 template<
typename T >
2299 operator <=( T const & t, xyzTriple< T >
const &
v );
2303 template<
typename T >
2309 template<
typename T >
2315 template<
typename T >
2321 template<
typename T >
2334 #endif // INCLUDED_numeric_xyzTriple_HH
void normalized(xyzTriple &a) const
Normalized.
friend Value angle_of(xyzTriple const &a, xyzTriple const &b, xyzTriple const &c)
Angle formed by three consecutive points (in radians on [ 0, pi ])
void normalized_or_zero(xyzTriple &a) const
Normalized: zero xyzTriple if length is zero.
Value dot_product(xyzTriple const &v) const
Dot product.
friend void center(xyzTriple const &a, xyzTriple const &b, xyzTriple const &c, xyzTriple const &d, xyzTriple &m)
Center of 4 xyzTriples: Return via argument (slightly faster)
xyzTriple normalized_any() const
Normalized copy: Arbitrary normalized xyzTriple if length is zero.
Value length_squared() const
Length squared.
Value const & x() const
Value x const.
xyzTriple cross(xyzTriple const &v) const
Cross product.
xyzTriple & project_parallel(xyzTriple const &v)
Project parallel.
friend xyzTriple center(xyzTriple const &a, xyzTriple const &b)
Center of 2 xyzTriples.
friend Value angle_of(xyzTriple const &a, xyzTriple const &b)
Angle between two vectors (in radians on [ 0, pi ])
void negated(xyzTriple &a) const
Negated: Return via argument (slightly faster)
bool operator==(BodyPosition< T > const &p1, BodyPosition< T > const &p2)
BodyPosition == BodyPosition.
void normalized(Value const &length_a, xyzTriple &a) const
Normalized to a length.
Value magnitude() const
Magnitude.
xyzTriple(xyzTriple< U > const &v)
Copy constructor.
void normalized_any(Value const &length_a, xyzTriple &a) const
Normalized to a length: arbitrary normalized xyzTriple if length is zero.
xyzTriple(Value const &t)
Uniform value constructor.
xyzTriple normalized_or_zero(Value const &length_a) const
Normalized to a length copy: Zero xyzTriple if length is zero.
xyzTriple cross_product(xyzTriple const &v) const
Cross product.
friend Value cos_of(xyzTriple const &a, xyzTriple const &b)
Cosine of angle between two vectors.
xyzTriple & project_normal(xyzTriple const &v)
Project normal.
xyzTriple & normalize(Value const &length_a)
Normalize to a length.
friend xyzTriple midpoint(xyzTriple const &a, xyzTriple const &b)
Midpoint of 2 xyzTriples.
void subtract(xyzTriple< T > const &a, xyzTriple< T > const &b, xyzTriple< T > &r)
Subtract: xyzTriple - xyzTriple.
friend void add(Value const &t, xyzTriple const &v, xyzTriple &r)
Add: Value + xyzTriple.
T sin_of(xyzTriple< T > const &a, xyzTriple< T > const &b)
Sine of angle between two vectors.
xyzTriple & operator*=(Value const &t)
*= Value
friend void multiply(xyzTriple const &v, Value const &t, xyzTriple &r)
Multiply: xyzTriple * Value.
T cos_of(xyzTriple< T > const &a, xyzTriple< T > const &b)
Cosine of angle between two vectors.
friend Value sin_of(xyzTriple const &a, xyzTriple const &b, xyzTriple const &c)
Sine of angle formed by three consecutive points.
xyzTriple operator-() const
-xyzTriple (negated copy)
friend xyzTriple operator+(xyzTriple const &a, xyzTriple const &b)
xyzTriple + xyzTriple
bool is_unit(Value const &tol) const
Is a unit vector to within a tolerance?
T const & const_reference
Value const & at(int const i) const
xyzVector.at: 0-based index with bounds checking
Value const & z() const
Value z const.
MathMatrix< T > operator*(const MathMatrix< T > &MATRIX_LHS, const MathMatrix< T > &MATRIX_RHS)
multiply two matrixs of equal size by building the inner product yielding the scalar product ...
void multiply(xyzTriple< T > const &v, T const &t, xyzTriple< T > &r)
Multiply: xyzTriple * T.
friend bool operator!=(xyzTriple const &a, xyzTriple const &b)
xyzTriple != xyzTriple
void y(Value const &y_a)
y assignment
T angle_of(xyzTriple< T > const &a, xyzTriple< T > const &b)
Angle between two vectors (in radians on [ 0, pi ])
void z(Value const &z_a)
z assignment
Value dot(xyzTriple const &v) const
Dot product.
friend Value dot(xyzTriple const &a, xyzTriple const &b)
Dot product.
xyzTriple & normalize_or_zero(Value const &length_a)
Normalize to a length: zero xyzTriple if length is zero.
xyzTriple & negate()
Negate.
friend void add(xyzTriple const &v, Value const &t, xyzTriple &r)
Add: xyzTriple + Value.
friend void center(xyzTriple const &a, xyzTriple const &b, xyzTriple const &c, xyzTriple &m)
Center of 3 xyzTriples: Return via argument (slightly faster)
Value const & operator[](int const i) const
xyzTriple[ i ] const: 0-based index
xyzTriple & min(xyzTriple const &v)
Set minimum coordinates wrt another xyzTriple.
Value length() const
Length.
xyzTriple & operator/=(Value const &t)
/= Value
xyzTriple< T > center(xyzTriple< T > const &a, xyzTriple< T > const &b)
Center of 2 xyzTriples.
friend xyzTriple cross_product(xyzTriple const &a, xyzTriple const &b)
Cross product.
void x(Value const &x_a)
x assignment
bool longer(xyzTriple const &v)
Longer?
MathMatrix< T > operator-(const MathMatrix< T > &MATRIX_LHS, const MathMatrix< T > &MATRIX_RHS)
subtract two matrixs of equal size
bool is_normalized(Value const &tol) const
Is normalized to within a tolerance?
T distance_squared(xyzTriple< T > const &a, xyzTriple< T > const &b)
Distance squared.
friend void subtract(Value const &t, xyzTriple const &v, xyzTriple &r)
Subtract: Value - xyzTriple.
xyzTriple & max(xyzTriple const &v)
Set maximum coordinates wrt another xyzTriple.
friend bool equal_length(xyzTriple const &a, xyzTriple const &b)
Equal length?
T sin_cos_range(T const &x, T const &tol=T(.001))
Adjust a sine or cosine value to the valid [-1,1] range if within a specified tolerance or exit with ...
Value norm_squared() const
Norm squared.
friend void subtract(xyzTriple const &a, xyzTriple const &b, xyzTriple &r)
Subtract: xyzTriple - xyzTriple.
xyzTriple & clear()
Clear.
xyzTriple< T > midpoint(xyzTriple< T > const &a, xyzTriple< T > const &b)
Midpoint of 2 xyzTriples.
friend void midpoint(xyzTriple const &a, xyzTriple const &b, xyzTriple &m)
Midpoint of 2 xyzTriples: Return via argument (slightly faster)
bool shorter(xyzTriple const &v)
Shorter?
Fast (x,y,z)-coordinate vector container.
friend void cross_product(xyzTriple const &a, xyzTriple const &b, xyzTriple &c)
Cross product: Return via argument (slightly faster)
xyzTriple normalized(Value const &length_a) const
Normalized to a length copy.
xyzTriple & normalize_any()
Normalize: arbitrary normalized xyzTriple if length is zero.
bool operator>=(xyzMatrix< T > const &a, xyzMatrix< T > const &b)
xyzMatrix >= xyzMatrix
xyzTriple< T > cross_product(xyzTriple< T > const &a, xyzTriple< T > const &b)
Cross product.
bool is_unit() const
Is exactly a unit vector?
friend xyzTriple cross(xyzTriple const &a, xyzTriple const &b)
Cross product.
short int min(short int const a, short int const b)
min( short int, short int )
void add(xyzTriple< T > const &a, xyzTriple< T > const &b, xyzTriple< T > &r)
Add: xyzTriple + xyzTriple.
short int max(short int const a, short int const b)
max( short int, short int )
MathMatrix< T > operator/(const MathMatrix< T > &MATRIX_LHS, const T &SCALAR_RHS)
divide matrix with scalar
xyzTriple & scaled_sub(Value const &t, xyzTriple< U > const &v)
Subtract Value * xyzTriple.
xyzTriple & operator+=(xyzTriple< U > const &v)
+= xyzTriple
friend xyzTriple center(xyzTriple const &a, xyzTriple const &b, xyzTriple const &c)
Center of 3 xyzTriples.
friend bool operator>(xyzTriple const &a, xyzTriple const &b)
xyzTriple > xyzTriple
friend xyzTriple max(xyzTriple const &a, xyzTriple const &b)
xyzTriple with max coordinates of two xyzTriples
bool is_zero() const
Is zero?
xyzTriple normalized_any(Value const &length_a) const
Normalized to a length copy: Arbitrary normalized xyzTriple if length is zero.
bool longer_or_equal(xyzTriple const &v)
Longer or equal length?
void normalized_or_zero(Value const &length_a, xyzTriple &a) const
Normalized to a length: zero xyzTriple if length is zero.
friend xyzTriple center(xyzTriple const &a, xyzTriple const &b, xyzTriple const &c, xyzTriple const &d)
Center of 4 xyzTriples.
friend void cross(xyzTriple const &a, xyzTriple const &b, xyzTriple &c)
Cross product: Return via argument (slightly faster)
friend void add(xyzTriple const &a, xyzTriple const &b, xyzTriple &r)
Add: xyzTriple + xyzTriple.
xyzTriple normalized() const
Normalized copy.
xyzTriple(U const *p)
Pointer to contiguous values constructor.
friend Value cos_of(xyzTriple const &a, xyzTriple const &b, xyzTriple const &c)
Cosine of angle formed by three consecutive points.
xyzTriple & scaled_assign(Value const &t, xyzTriple< U > const &v)
Assign Value * xyzTriple.
xyzTriple(xyzTriple const &v)
Copy constructor.
Value distance_squared(xyzTriple const &v) const
Distance squared.
friend void multiply(Value const &t, xyzTriple const &v, xyzTriple &r)
Multiply: Value * xyzTriple.
T inner_product(xyzTriple< T > const &a, xyzTriple< T > const &b)
Inner product ( == dot product )
xyzTriple negated() const
Negated copy.
friend Value dot_product(xyzTriple const &a, xyzTriple const &b)
Dot product.
friend xyzTriple operator*(xyzTriple const &v, Value const &t)
xyzTriple * Value
friend void divide(xyzTriple const &v, Value const &t, xyzTriple &r)
Divide: xyzTriple / Value.
T distance(MathVector< T > const &VECTOR_A, MathVector< T > const &VECTOR_B)
bool shorter_or_equal(xyzTriple const &v)
Shorter or equal length?
bool operator>(xyzMatrix< T > const &a, xyzMatrix< T > const &b)
xyzMatrix > xyzMatrix
bool not_equal_length(xyzTriple const &v)
Not equal length?
xyzTriple & normalize()
Normalize.
xyzTriple & operator-=(xyzTriple< U > const &v)
-= xyzTriple
xyzTriple(Value const &x_a, Value const &y_a, Value const &z_a)
Triple value constructor.
friend bool operator==(xyzTriple const &a, xyzTriple const &b)
xyzTriple == xyzTriple
friend void subtract(xyzTriple const &v, Value const &t, xyzTriple &r)
Subtract: xyzTriple - Value.
xyzTriple< T > cross(xyzTriple< T > const &a, xyzTriple< T > const &b)
Cross product.
xyzTriple & normalize_any(Value const &length_a)
Normalize to a length: arbitrary normalized xyzTriple if length is zero.
xyzTriple normalized_or_zero() const
Normalized copy: Zero xyzTriple if length is zero.
friend xyzTriple min(xyzTriple const &a, xyzTriple const &b)
xyzTriple with min coordinates of two xyzTriples
bool operator!=(BodyPosition< T > const &p1, BodyPosition< T > const &p2)
BodyPosition != BodyPosition.
friend bool operator<(xyzTriple const &a, xyzTriple const &b)
xyzTriple < xyzTriple: Lexicographic order
Value magnitude_squared() const
Magnitude squared.
T dot_product(Quaternion< T > const &q1, Quaternion< T > const &q2)
Dot product.
numeric::xyzTriple forward declarations
xyzTriple projected_parallel(xyzTriple const &v) const
Projected parallel copy.
Value inner_product(xyzTriple const &v) const
Inner product ( == dot product )
xyzTriple & scaled_add(Value const &t, xyzTriple< U > const &v)
Add Value * xyzTriple.
MathMatrix< T > operator+(const MathMatrix< T > &MATRIX_LHS, const MathMatrix< T > &MATRIX_RHS)
sum two matrixs of equal size
void normalized_any(xyzTriple &a) const
Normalized: arbitrary normalized xyzTriple if length is zero.
Value distance(xyzTriple const &v) const
Distance.
friend Value distance(xyzTriple const &a, xyzTriple const &b)
Distance.
xyzTriple & assign(Value const &x_a, Value const &y_a, Value const &z_a)
Triple value assignment.
static Value square(Value const &t)
square( t ) == t * t
void projected_parallel(xyzTriple const &v, xyzTriple &a)
Projected parallel.
bool is_normalized() const
Is exactly normalized?
friend xyzTriple operator/(xyzTriple const &v, Value const &t)
xyzTriple / Value
friend Value sin_of(xyzTriple const &a, xyzTriple const &b)
Sine of angle between two vectors.
void projected_normal(xyzTriple const &v, xyzTriple &a) const
Projected normal.
bool not_equal_length(xyzTriple< T > const &a, xyzTriple< T > const &b)
Not equal length?
xyzTriple & normalize_or_zero()
Normalize: zero xyzTriple if length is zero.
Value const & operator()(int const i) const
xyzTriple( i ) const: 1-based index
friend bool operator<=(xyzTriple const &a, xyzTriple const &b)
xyzTriple <= xyzTriple
friend bool operator>=(xyzTriple const &a, xyzTriple const &b)
xyzTriple >= xyzTriple
void divide(xyzTriple< T > const &v, T const &t, xyzTriple< T > &r)
Divide: xyzTriple / T.
xyzTriple & operator=(xyzTriple const &v)
Copy assignment.
T dot(Quaternion< T > const &q1, Quaternion< T > const &q2)
Dot product.
friend bool not_equal_length(xyzTriple const &a, xyzTriple const &b)
Not equal length?
Value const & y() const
Value y const.
friend Value distance_squared(xyzTriple const &a, xyzTriple const &b)
Distance squared.
xyzTriple()
Default constructor.
Value & at(int const i)
xyzVector.at: 0-based index with bounds checking
bool equal_length(xyzTriple< T > const &a, xyzTriple< T > const &b)
Equal length?
Value x_
Coordinates of the 3 coordinate vector.
friend void center(xyzTriple const &a, xyzTriple const &b, xyzTriple &m)
Center of 2 xyzTriples: Return via argument (slightly faster)
xyzTriple projected_normal(xyzTriple const &v) const
Projected normal copy.
friend Value inner_product(xyzTriple const &a, xyzTriple const &b)
Inner product ( == dot product )
bool equal_length(xyzTriple const &v)
Equal length?