5 #ifndef BALL_MATHS_VECTOR4_H
6 #define BALL_MATHS_VECTOR4_H
8 #ifndef BALL_COMMON_EXCEPTION_H
12 #ifndef BALL_MATHS_ANGLE_H
16 #ifdef BALL_HAS_IEEEFP_H
46 std::ostream& operator << (std::ostream& s, const TVector4<T>& vector);
74 TVector4(const T* ptr);
81 explicit TVector4(const T& value);
90 TVector4(const T&
x, const T&
y, const T&
z, const T&
h = (T)1);
96 TVector4(const TVector4& vector);
109 x = y = z =
h = (T)0;
123 void set(
const T* ptr);
131 void set(
const T& rx,
const T& ry,
const T& rz,
const T& rh = (T)1);
163 void get(T* ptr)
const;
171 void get(T& rx, T& ry, T& rz, T& rh)
const;
222 void set(
const T& value = (T)1);
348 void dump(std::ostream& s = std::cout,
Size depth = 0)
const;
376 template <
typename T>
385 template <
typename T>
400 template <
typename T>
409 template <
typename T>
418 template <
typename T>
427 template <
typename T>
432 template <
typename T>
446 template <
typename T>
456 template <
typename T>
466 template <
typename T>
482 template <
typename T>
494 template <
typename T>
506 template <
typename T>
520 template <
typename T>
530 template <
typename T>
540 template <
typename T>
560 template <
typename T>
564 return (T)sqrt(x * x + y * y + z * z +
h *
h);
567 template <
typename T>
571 return (T)(x * x + y * y + z * z +
h *
h);
574 template <
typename T>
578 T len = (T)sqrt(x * x + y * y + z * z +
h *
h);
593 template <
typename T>
601 template <
typename T>
609 template <
typename T>
613 x = y = z =
h = value;
616 template <
typename T>
635 template <
typename T>
654 template <
typename T>
661 template <
typename T>
668 template <
typename T>
680 template <
typename T>
692 template <
typename T>
696 return TVector4<T>(x * scalar, y * scalar, z * scalar,
h * scalar);
699 template <
typename T>
711 template <
typename T>
718 return TVector4<T>(x / scalar, y / scalar, z / scalar,
h / scalar);
721 template <
typename T>
736 template <
typename T>
740 return (x * v.
x + y * v.
y + z * v.
z +
h * v.
h);
743 template <
typename T>
752 return (T)sqrt(da * da + db * db + dc * dc + dd * dd);
755 template <
typename T>
764 return (da * da + db * db + dc * dc + dd * dd);
767 template <
typename T>
775 template <
typename T>
783 template <
typename T>
790 template <
typename T>
797 template <
typename T>
808 <<
", h = " <<
h << std::endl;
819 template <
typename T>
829 template <
typename T>
839 template <
typename T>
843 return TVector4<T>(scalar * v.
x, scalar * v.
y, scalar * v.
z, scalar * v.
h);
849 template <
typename T>
853 return TVector4<T>(scalar * v.
x, scalar * v.
y, scalar * v.
z, scalar * v.
h);
860 template <
typename T>
864 s >> c >> v.
x >> v.
y >> v.
z >> v.
h >>
c;
874 template <
typename T>
875 std::ostream& operator << (std::ostream& s, const TVector4<T>& v)
877 s <<
'(' <<v.x <<
' ' << v.y <<
' ' << v.z <<
' ' << v.h <<
')';
883 #endif // BALL_MATHS_VECTOR4_H
TVector4 & operator*=(const T &scalar)
#define BALL_CREATE(name)
bool isEqual(const T1 &a, const T2 &b)
TVector4 & operator/=(const T &scalar)
T & operator[](Position position)
static const TVector4 & getZero()
bool operator!=(const TVector4 &vector) const
TVector4 operator+() const
TVector4 & operator-=(const TVector4 &vector)
std::istream & operator>>(std::istream &is, TRegularData1D< ValueType > &grid)
Input operator.
static const TVector4 & getUnit()
TVector4 & operator+=(const TVector4 &vector)
bool operator==(const TVector4 &vector) const
TVector4 operator-() const
BALL_EXTERN_VARIABLE const double h
BALL_EXTERN_VARIABLE const double c
T getDistance(const TVector4 &vector) const
#define BALL_DUMP_HEADER(os, cl, ob)
TVector4< float > Vector4
void swap(TVector4 &vector)
TVector4 operator*(const T &scalar)
void dump(std::ostream &s=std::cout, Size depth=0) const
bool isNotEqual(const T1 &a, const T2 &b)
T getSquareLength() const
BALL_INLINE TAngle< T > operator*(const T &val, const TAngle< T > &angle)
TVector4 operator/(const T &scalar)
#define BALL_DUMP_STREAM_PREFIX(os)
ConstRandomAccessIterator< Container, DataType, Position, Traits > operator+(Distance distance, const ConstRandomAccessIterator< Container, DataType, Position, Traits > &iterator)
TVector4 & operator=(const T *ptr)
#define BALL_DUMP_STREAM_SUFFIX(os)
#define BALL_DUMP_DEPTH(os, depth)
BALL_INLINE TAngle< T > operator-(const T &val, const TAngle< T > &angle)
T getSquareDistance(const TVector4 &vector) const
bool isOrthogonalTo(const TVector4 &vector) const