Go to the documentation of this file. 1 #ifndef GeometryVector_newBasic2DVector_h
2 #define GeometryVector_newBasic2DVector_h
43 template <
class Other>
64 T x()
const {
return v[0];}
67 T y()
const {
return v[1];}
90 return my_mag == 0 ? *this : *
this / my_mag;
162 std::ostream &
print2D(std::ostream&
s,
double x,
double y);
185 template <
class T,
class U>
189 return RT(
a) + RT(
b);
192 template <
class T,
class U>
209 template <
class T,
class U>
232 template <
class T,
class Scalar>
234 T t = static_cast<T>(
s);
239 template <
class T,
class Scalar>
241 T t = static_cast<T>(
s);
253 template <
class T,
class Scalar>
256 T t = static_cast<T>(
s);
264 #endif // GeometryVector_Basic2DVector_h
T dot(const Basic3DVector &v) const
Scalar product, or "dot" product, with a vector of same type.
std::ostream & operator<<(std::ostream &s, const Basic2DVector< T > &v)
simple text output to standard streams
Basic2DVector(Vec2< U > const &iv)
Basic2DVector< double > Basic2DVectorD
Geom::Phi< T > phi() const
Basic2DVector & operator+=(const Basic2DVector< U > &p)
T operator[](int i) const
Basic2DVector< float > Basic2DVectorF
Basic2DVector(const Basic2DVector< U > &p)
Basic2DVector< T > operator+(const Basic2DVector< T > &a, const Basic2DVector< T > &b)
vector sum and subtraction of vectors of possibly different precision
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(Vec4< U > const &iv)
T y() const
Cartesian y coordinate.
T cross(const Basic2DVector &lh) const
Vector product, or "cross" product, with a vector of same type.
PreciseFloatType< T, U >::Type cross(const Basic2DVector< U > &lh) const
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< T > operator-(const Basic2DVector< T > &a, const Basic2DVector< T > &b)
Basic2DVector & operator/=(T t)
Scaling by a scalar value (division)
PreciseFloatType< T, U >::Type dot(const Basic2DVector< U > &lh) const
Basic2DVector unit() const
Geom::Polar2Cartesian< T > Polar
Basic2DVector(const Other &p)
T operator*(const Basic2DVector< T > &v1, const Basic2DVector< T > &v2)
T mag2() const
The vector magnitude squared. Equivalent to vec.dot(vec)
Basic2DVector(MathVector const &iv)
Basic2DVector(const Basic2DVector &p)
Copy constructor from same type. Should not be needed but for gcc bug 12685.
MathVector & mathVector()
const MathVector & mathVector() const
std::ostream & print2D(std::ostream &s, double x, double y)
auto cross2(V1 x, V2 y) -> typename std::remove_reference< decltype(x[0])>::type
Basic2DVector< T > operator/(const Basic2DVector< T > &v, T t)