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]; }
69 double const &
y()
const {
return fVec[1]; }
72 double const &
z()
const {
return fVec[2]; }
81 void Set(
double const &
a,
double const &
b,
double const &
c)
99 return left[0] * right[0] + left[1] * right[1] + left[2] * right[2];
106 double Mag2()
const {
return Dot(*
this, *
this); }
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)
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t index
#define Vertex_t_BINARY_OP(OPERATOR, INPLACE)
#define Vertex_t_INPLACE_BINARY_OP(OPERATOR)
bool operator!=(Vertex_t const &lhs, Vertex_t const &rhs)
bool operator==(Vertex_t const &lhs, Vertex_t const &rhs)
This file contains a specialised ROOT message handler to test for diagnostic in unit tests.
Double_t ACos(Double_t)
Returns the principal value of the arc cosine of x, expressed in radians.
Short_t Max(Short_t a, Short_t b)
Returns the largest of a and b.
Double_t ATan2(Double_t y, Double_t x)
Returns the principal value of the arc tangent of y/x, expressed in radians.
Double_t Sqrt(Double_t x)
Returns the square root of x.
Short_t Min(Short_t a, Short_t b)
Returns the smallest of a and b.
Short_t Abs(Short_t d)
Returns the absolute value of parameter Short_t d.
double & operator[](const int index)
void Set(double const &a, double const &b, double const &c)
void CopyTo(double *dest) const
bool IsNormalized() const
static Vertex_t Cross(Vertex_t const &left, Vertex_t const &right)
The cross (vector) product of two Vector3D<T> objects.
void Normalize()
Normalizes the vector by dividing each entry by the length.
Vertex_t(const double a=0.)
Vertex_t(const double a, const double b, const double c)
double const & operator[](const int index) const
double Dot(Vertex_t const &right) const
The dot product of two vector.
static double Dot(Vertex_t const &left, Vertex_t const &right)
The dot product of two vector objects.
#define dest(otri, vertexptr)