Go to the documentation of this file. 1 #ifndef GeometryVector_oldBasic2DVector_h
2 #define GeometryVector_oldBasic2DVector_h
7 #if (!defined(__CLING__))
41 template <
class Other>
48 #if defined(USE_EXTVECT)
56 #elif defined(USE_SSEVECT)
96 return my_mag == 0 ? *this : *
this / my_mag;
144 return x()*
v.x() +
y()*
v.y();
159 return x()*
v.y() -
y()*
v.x();
170 std::ostream &
print2D(std::ostream&
s,
double x,
double y);
182 template <
class T,
class U>
186 return RT(
a.x()+
b.x(),
a.y()+
b.y());
189 template <
class T,
class U>
193 return RT(
a.x()-
b.x(),
a.y()-
b.y());
206 template <
class T,
class U>
209 return v1.
x()*v2.
x() + v1.
y()*v2.
y();
215 template <
class T,
class Scalar>
217 T t = static_cast<T>(
s);
222 template <
class T,
class Scalar>
224 T t = static_cast<T>(
s);
231 template <
class T,
class Scalar>
233 T t = static_cast<T>(
s);
241 #endif // GeometryVector_Basic2DVector_h
Geom::Phi< T > phi() const
Basic2DVector & operator+=(const Basic2DVector< U > &p)
Basic2DVector< typename PreciseFloatType< T, U >::Type > operator+(const Basic2DVector< T > &a, const Basic2DVector< U > &b)
vector sum and subtraction of vectors of possibly different precision
T operator[](int i) const
PreciseFloatType< T, U >::Type dot(const Basic2DVector< U > &v) const
PreciseFloatType< T, U >::Type cross(const Basic2DVector< U > &v) const
T mag() const
The vector magnitude. Equivalent to sqrt(vec.mag2())
Basic2DVector operator-() const
Unary minus, returns a vector with components (-x(),-y(),-z())
T r() const
Radius, same as mag()
T dot(const Basic2DVector &v) const
Scalar product, or "dot" product, with a vector of same type.
Basic2DVector< T > MathVector
T operator*(const Basic2DVector< T > &v1, const Basic2DVector< T > &v2)
T y() const
Cartesian y coordinate.
Basic2DVector< T > operator/(const Basic2DVector< T > &v, const Scalar &s)
Basic2DVector(const T &x, const T &y)
construct from cartesian coordinates
Basic2DVector & operator-=(const Basic2DVector< U > &p)
T dot(const Basic2DVector &lh) const
Scalar product, or "dot" product, with a vector of same type.
T x() const
Cartesian x coordinate.
Basic2DVector & operator*=(T t)
Scaling by a scalar value (multiplication)
Basic2DVector< typename PreciseFloatType< T, U >::Type > operator-(const Basic2DVector< T > &a, const Basic2DVector< U > &b)
Basic2DVector & operator/=(T t)
Scaling by a scalar value (division)
Basic2DVector< float > Basic2DVectorF
Basic2DVector< double > Basic2DVectorD
Basic2DVector unit() const
Geom::Polar2Cartesian< T > Polar
Basic2DVector(const Other &p)
T cross(const Basic2DVector &v) const
Vector product, or "cross" product, with a vector of same type.
T mag2() const
The vector magnitude squared. Equivalent to vec.dot(vec)
Basic2DVector(const Basic2DVector &p)
Copy constructor from same type. Should not be needed but for gcc bug 12685.
std::ostream & operator<<(std::ostream &s, const Basic2DVector< T > &v)
simple text output to standard streams
std::ostream & print2D(std::ostream &s, double x, double y)