1 #ifndef GeometryVector_newBasic2DVector_h
2 #define GeometryVector_newBasic2DVector_h
43 template <
class Other>
62 T x()
const {
return v[0];}
65 T y()
const {
return v[1];}
88 return my_mag == 0 ? *
this : *
this / my_mag;
159 namespace geometryDetails {
160 std::ostream &
print2D(std::ostream&
s,
double x,
double y);
166 inline std::ostream & operator<<( std::ostream& s, const Basic2DVector<T>&
v) {
183 template <
class T,
class U>
187 return RT(a) + RT(b);
190 template <
class T,
class U>
207 template <
class T,
class U>
230 template <
class T,
class Scalar>
232 T t =
static_cast<T>(
s);
237 template <
class T,
class Scalar>
239 T t =
static_cast<T>(
s);
251 template <
class T,
class Scalar>
254 T t =
static_cast<T>(
s);
262 #endif // GeometryVector_Basic2DVector_h
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(mathSSE::Vec2< U > const &iv)
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.
Vec2< TmpType > MathVector
MatrixMeschach operator-(const MatrixMeschach &mat1, const MatrixMeschach &mat2)
MathVector const & mathVector() 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())
PreciseFloatType< T, U >::Type cross(const Basic2DVector< U > &lh) const
T r() const
Radius, same as mag()
Basic2DVector(const Basic2DVector< U > &p)
Basic2DVector(const Other &p)
Basic3DVector< long double > operator/(const Basic3DVector< long double > &v, S s)
Basic2DVector< double > Basic2DVectorD
Basic2DVector unit() const
PreciseFloatType< T, U >::Type dot(const Basic2DVector< U > &lh) const
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)
std::ostream & print2D(std::ostream &s, double x, double y)
Basic2DVector & operator+=(const Basic2DVector< U > &p)
T y() const
Cartesian y coordinate.
MathVector & mathVector()
Basic2DVector & operator-=(const Basic2DVector< U > &p)
T mag2() const
The vector magnitude squared. Equivalent to vec.dot(vec)
T operator[](int i) const
Basic2DVector(mathSSE::Vec4< U > const &iv)
T dot(const Basic3DVector &v) const
Scalar product, or "dot" product, with a vector of same type.
MatrixMeschach operator*(const MatrixMeschach &mat1, const MatrixMeschach &mat2)
mathSSE::Vec2< T > MathVector
Geom::Phi< T > phi() const
mathSSE::Vec2< T > VectorType
T x() const
Cartesian x coordinate.
Basic3DVector cross(const Basic3DVector &v) const
Vector product, or "cross" product, with a vector of same type.