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();
169 namespace geometryDetails {
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
MatrixMeschach operator+(const MatrixMeschach &mat1, const MatrixMeschach &mat2)
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.
MatrixMeschach operator-(const MatrixMeschach &mat1, const MatrixMeschach &mat2)
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)
Basic3DVector< long double > operator/(const Basic3DVector< long double > &v, S s)
Basic2DVector< double > Basic2DVectorD
Basic2DVector unit() const
T x() const
Cartesian x coordinate.
Basic2DVector< float > Basic2DVectorF
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.
PreciseFloatType< T, U >::Type dot(const Basic2DVector< U > &v) const
Basic2DVector & operator-=(const Basic2DVector< U > &p)
T mag2() const
The vector magnitude squared. Equivalent to vec.dot(vec)
T operator[](int i) const
Basic2DVector< T > MathVector
PreciseFloatType< T, U >::Type cross(const Basic2DVector< U > &v) const
MatrixMeschach operator*(const MatrixMeschach &mat1, const MatrixMeschach &mat2)
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.