16#ifndef ROOT_Math_GenVector_Cartesian2D
17#define ROOT_Math_GenVector_Cartesian2D 1
38template <
class T =
double>
61 template <
class CoordSystem>
114 const Scalar s = sin(angle);
124 template <
class CoordSystem>
135 return fX == rhs.
fX &&
fY == rhs.
fY;
155 fX =
r * cos(
v.Phi());
157 fY =
r * sin(
v.Phi());
169 fX =
r * cos(
v.Phi());
171 fY =
r * sin(
v.Phi());
177#if defined(__ROOTCLING__) || defined(G__DICTIONARY)
203#if defined(__ROOTCLING__) || defined(G__DICTIONARY)
218 void Cartesian2D<T>::SetR(Scalar
r) {
219 GenVector_exception
e(
"Cartesian2D::SetR() is not supposed to be called");
221 Polar2D<Scalar>
v(*
this);
v.SetR(
r); *
this = Cartesian2D<Scalar>(
v);
Class describing a 2D cartesian coordinate system (x, y coordinates).
void SetX(Scalar a)
set the x coordinate value keeping y constant
bool operator!=(const Cartesian2D &rhs) const
bool operator==(const Cartesian2D &rhs) const
Exact equality.
void Scale(Scalar a)
scale the vector by a scalar quantity a
void Negate()
negate the vector
void SetY(Scalar a)
set the y coordinate value keeping x constant
void SetXY(Scalar xx, Scalar yy)
set all values using cartesian coordinates
static constexpr unsigned int Dimension
void GetCoordinates(Scalar &xx, Scalar &yy) const
get internal data into 2 Scalar numbers
constexpr Cartesian2D(const CoordSystem &v)
Construct from any Vector or coordinate system implementing X() and Y().
constexpr Cartesian2D(const Polar2D< T2 > &v)
Cartesian2D & operator=(const CoordSystem &v)
Assignment from any class implementing x(),y() (can assign from any coordinate system).
void SetCoordinates(Scalar xx, Scalar yy)
Set internal data based on 2 Scalar numbers.
T fX
(Contiguous) data containing the coordinates values x and y
constexpr Cartesian2D() noexcept=default
Default constructor with x=y=0.
void Rotate(Scalar angle)
rotate by an angle
Class describing a polar 2D coordinate system based on r and phi Phi is restricted to be in the range...
Namespace for new Math classes and functions.
VecExpr< UnaryOp< Sqrt< T >, VecExpr< A, T, D >, T >, T, D > sqrt(const VecExpr< A, T, D > &rhs)
Rotation3D::Scalar Scalar