Go to the documentation of this file. 1 #ifndef GeometryVector_newBasic2DVector_h
2 #define GeometryVector_newBasic2DVector_h
39 template <
class Other>
58 T x()
const {
return v[0]; }
61 T y()
const {
return v[1]; }
84 return my_mag == 0 ? *this : *
this / my_mag;
152 std::ostream&
print2D(std::ostream&
s,
double x,
double y);
172 template <
class T,
class U>
176 return RT(
a) + RT(
b);
179 template <
class T,
class U>
183 return RT(
a) - RT(
b);
193 template <
class T,
class U>
212 template <
class T,
class Scalar>
214 T t = static_cast<T>(
s);
219 template <
class T,
class Scalar>
221 T t = static_cast<T>(
s);
233 template <
class T,
class Scalar>
236 T t = static_cast<T>(
s);
243 #endif // GeometryVector_Basic2DVector_h
T dot(const Basic3DVector &v) const
Scalar product, or "dot" product, with a vector of same type.
Basic2DVector(mathSSE::Vec2< U > const &iv)
Geom::Phi< T > phi() const
Basic2DVector & operator+=(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 operator[](int i) const
Basic2DVector(mathSSE::Vec4< U > const &iv)
Basic2DVector(const Basic2DVector< U > &p)
T operator*(const Basic2DVector< T > &v1, const Basic2DVector< T > &v2)
T mag() const
The vector magnitude. Equivalent to sqrt(vec.mag2())
Basic2DVector operator-() const
Unary minus, returns a vector with components (-x(),-y(),-z())
PreciseFloatType< T, U >::Type dot(const Basic2DVector< U > &lh) const
std::ostream & operator<<(std::ostream &s, const Basic2DVector< T > &v)
simple text output to standard streams
T r() const
Radius, same as mag()
T y() const
Cartesian y coordinate.
T cross(const Basic2DVector &lh) const
Vector product, or "cross" product, with a vector of same type.
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.
mathSSE::Vec2< T > MathVector
T x() const
Cartesian x coordinate.
Basic2DVector & operator*=(T t)
Scaling by a scalar value (multiplication)
Basic2DVector & operator/=(T t)
Scaling by a scalar value (division)
MathVector const & mathVector() const
Basic2DVector< T > operator/(const Basic2DVector< T > &v, T t)
Basic3DVector cross(const Basic3DVector &v) const
Vector product, or "cross" product, with a vector of same type.
Basic2DVector< double > Basic2DVectorD
mathSSE::Vec2< T > VectorType
Basic2DVector unit() const
Geom::Polar2Cartesian< T > Polar
Basic2DVector(const Other &p)
T mag2() const
The vector magnitude squared. Equivalent to vec.dot(vec)
PreciseFloatType< T, U >::Type cross(const Basic2DVector< U > &lh) const
Basic2DVector(const Basic2DVector &p)
Copy constructor from same type. Should not be needed but for gcc bug 12685.
MathVector & mathVector()
Basic2DVector< T > operator-(const Basic2DVector< T > &a, const Basic2DVector< T > &b)
Basic2DVector< float > Basic2DVectorF
std::ostream & print2D(std::ostream &s, double x, double y)