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);
176 inline std::ostream & operator<<( std::ostream& s, const Basic2DVector<T>&
v) {
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
Basic2DVector(const T &x, const T &y)
construct from cartesian coordinates
Basic2DVector(const Basic2DVector &p)
Copy constructor from same type. Should not be needed but for gcc bug 12685.
T dot(const Basic2DVector &lh) const
Scalar product, or "dot" product, with a vector of same type.
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()
Basic2DVector(const Other &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
Basic2DVector unit() const
Geom::Polar2Cartesian< T > Polar
Basic2DVector & operator*=(T t)
Scaling by a scalar value (multiplication)
Basic2DVector & operator/=(T t)
Scaling by a scalar value (division)
T dot(const Basic2DVector &v) const
Scalar product, or "dot" product, with a vector of same type.
std::ostream & print2D(std::ostream &s, double x, double y)
Basic2DVector & operator+=(const Basic2DVector< U > &p)
T y() const
Cartesian y coordinate.
Basic2DVector< float > Basic2DVectorF
PreciseFloatType< T, U >::Type dot(const Basic2DVector< U > &v) const
Basic2DVector & operator-=(const Basic2DVector< U > &p)
Basic2DVector< double > Basic2DVectorD
T mag2() const
The vector magnitude squared. Equivalent to vec.dot(vec)
Basic2DVector< T > operator/(const Basic2DVector< T > &v, const Scalar &s)
T operator[](int i) const
T operator*(const Basic2DVector< T > &v1, const Basic2DVector< T > &v2)
Basic2DVector< T > MathVector
PreciseFloatType< T, U >::Type cross(const Basic2DVector< U > &v) const
T cross(const Basic2DVector &v) const
Vector product, or "cross" product, with a vector of same type.
Geom::Phi< T > phi() const
T x() const
Cartesian x coordinate.