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