12#ifndef ROOT_TGeoVector3
13#define ROOT_TGeoVector3
43#define Vertex_t_INPLACE_BINARY_OP(OPERATOR) \
44 inline Vertex_t &operator OPERATOR(const Vertex_t &other) \
46 fVec[0] OPERATOR other.fVec[0]; \
47 fVec[1] OPERATOR other.fVec[1]; \
48 fVec[2] OPERATOR other.fVec[2]; \
51 inline Vertex_t &operator OPERATOR(const double &scalar) \
53 fVec[0] OPERATOR scalar; \
54 fVec[1] OPERATOR scalar; \
55 fVec[2] OPERATOR scalar; \
60#undef Vertex_t_INPLACE_BINARY_OP
66 double const &
x()
const {
return fVec[0]; }
68 double &
y() {
return fVec[1]; }
69 double const &
y()
const {
return fVec[1]; }
71 double &z() {
return fVec[2]; }
72 double const &z()
const {
return fVec[2]; }
74 inline void CopyTo(
double *
dest)
const
81 void Set(
double const &
a,
double const &
b,
double const &
c)
88 void Set(
const double a) { Set(
a,
a,
a); }
99 return left[0] * right[0] + left[1] * right[1] + left[2] * right[2];
103 double Dot(
Vertex_t const &right)
const {
return Dot(*
this, right); }
106 double Mag2()
const {
return Dot(*
this, *
this); }
111 double Length()
const {
return Mag(); }
113 double Length2()
const {
return Mag2(); }
116 void Normalize() { *
this *= (1. / Length()); }
121 bool IsNormalized()
const
123 double norm =
Mag2();
124 constexpr double tolerance = 1.e-10;
125 return 1. - tolerance < norm && norm < 1 + tolerance;
137 return Vertex_t(left[1] * right[2] - left[2] * right[1], left[2] * right[0] - left[0] * right[2],
138 left[0] * right[1] - left[1] * right[0]);
149 constexpr double kMinimum = std::numeric_limits<double>::min();
150 const double mag2 =
Mag2();
159 constexpr double kTolerance = 1.e-8;
166 return !(lhs == rhs);
169#define Vertex_t_BINARY_OP(OPERATOR, INPLACE) \
170 inline Vertex_t operator OPERATOR(const Vertex_t &lhs, const Vertex_t &rhs) \
172 Vertex_t result(lhs); \
173 result INPLACE rhs; \
176 inline Vertex_t operator OPERATOR(Vertex_t const &lhs, const double rhs) \
178 Vertex_t result(lhs); \
179 result INPLACE rhs; \
182 inline Vertex_t operator OPERATOR(const double lhs, Vertex_t const &rhs) \
184 Vertex_t result(lhs); \
185 result INPLACE rhs; \
189#undef Vertex_t_BINARY_OP
TBuffer & operator<<(TBuffer &buf, const Tmpl *obj)
TGLVector3 Cross(const TGLVector3 &v1, const TGLVector3 &v2)
#define Vertex_t_BINARY_OP(OPERATOR, INPLACE)
#define Vertex_t_INPLACE_BINARY_OP(OPERATOR)
SVector< T, D > Unit(const SVector< T, D > &rhs)
Unit.
T Mag2(const SVector< T, D > &rhs)
Vector magnitude square Template to compute .
T Mag(const SVector< T, D > &rhs)
Vector magnitude (Euclidian norm) Compute : .
bool operator!=(Vertex_t const &lhs, Vertex_t const &rhs)
bool operator==(Vertex_t const &lhs, Vertex_t const &rhs)
double Perp(const Vector1 &v, const Vector2 &u)
Find the magnitude of the vector component of v perpendicular to the given direction of u.
double Perp2(const Vector1 &v, const Vector2 &u)
Find the magnitude square of the vector component of v perpendicular to the given direction of u.
tbb::task_arena is an alias of tbb::interface7::task_arena, which doesn't allow to forward declare tb...
Short_t Max(Short_t a, Short_t b)
Float_t Normalize(Float_t v[3])
Normalize a vector v in place.
Double_t ATan2(Double_t y, Double_t x)
Double_t Sqrt(Double_t x)
Short_t Min(Short_t a, Short_t b)
double & operator[](const int index)
Vertex_t(const double a=0.)
Vertex_t(const double a, const double b, const double c)
double const & operator[](const int index) const
#define dest(otri, vertexptr)
static void output(int code)