76 #ifndef SLIP_VECTOR2D_HPP
77 #define SLIP_VECTOR2D_HPP
90 #include <boost/serialization/access.hpp>
91 #include <boost/serialization/split_member.hpp>
92 #include <boost/serialization/version.hpp>
93 #include <boost/serialization/base_object.hpp>
101 template <
typename T>
102 bool operator<(const Vector2d<T>& x,
const Vector2d<T>& y);
104 template <
typename T>
107 template <
typename T>
108 bool operator<=(const Vector2d<T>& x,
const Vector2d<T>& y);
110 template <
typename T>
124 template <
typename T>
286 const T&
get_x()
const;
302 const T&
get_y()
const;
321 void set_x(
const T& r);
338 void set_y(
const T& g);
351 void set(
const T& x1,
362 std::string
name()
const;
367 template<
class Archive>
368 void save(Archive & ar,
const unsigned int version)
const
370 ar & boost::serialization::base_object<slip::kvector<T,2> >(*this);
372 template<
class Archive>
373 void load(Archive & ar,
const unsigned int version)
375 ar & boost::serialization::base_object<slip::kvector<T,2> >(*this);
377 BOOST_SERIALIZATION_SPLIT_MEMBER()
449 tmp[0] = -(*this)[0];
450 tmp[1] = -(*this)[1];
458 return std::atan2((*
this)[1],(*
this)[0]);
472 bool operator<(const Vector2d<T>& x,
475 return (slip::Euclidean_norm<T>(x.begin(),x.end())
477 slip::Euclidean_norm<T>(y.begin(),y.end())
493 bool operator<=(const Vector2d<T>& x,
578 tmp[0] = V1[0] + V2[0];
579 tmp[1] = V1[1] + V2[1];
607 tmp[0] = V1[0] - V2[0];
608 tmp[1] = V1[1] - V2[1];
628 tmp[0] = val - V1[0];
629 tmp[1] = val - V1[1];
640 tmp[0] = V1[0] * V2[0];
641 tmp[1] = V1[1] * V2[1];
669 tmp[0] = V1[0] / V2[0];
670 tmp[1] = V1[1] / V2[1];
707 struct AE_rad :
public std::binary_function<_Tp, slip::Vector2d<_Tp>,slip::Vector2d<_Tp> >
712 _Tp x_norm =
std::sqrt(_Tp(1) + __x[0]*__x[0] + __x[1]*__x[1]);
713 _Tp y_norm =
std::sqrt(_Tp(1) + __y[0]*__y[0] + __y[1]*__y[1]);
715 return std::acos((_Tp(1) +__x[0]*__y[0] + __x[1]*__y[1]) / (x_norm * y_norm));
735 struct AE_deg :
public std::binary_function<_Tp, slip::Vector2d<_Tp>, slip::Vector2d<_Tp> >
740 _Tp x_norm =
std::sqrt(_Tp(1) + __x[0]*__x[0] + __x[1]*__x[1]);
741 _Tp y_norm =
std::sqrt(_Tp(1) + __y[0]*__y[0] + __y[1]*__y[1]);
747 template<
typename _Tp>
756 #endif //SLIP_VECTOR2D_HPP
const T & v() const
Accessor to the second dimension value of the Vector2d.
void set_x(const T &r)
Mutator of the first dimension value of the Vector2d.
void set_x2(const T &x2)
Mutator of the second dimension value of the Vector2d.
This is a linear (one-dimensional) static vector. This container statisfies the RandomAccessContainer...
T angle_degree() const
Computes the angle with the cartesian axis. The result is between the range [-360,360].
const T & get_x() const
Accessor to the first dimension value of the Vector2d.
slip::Vector2d< short > Vector2d_s
short alias
A structure for numeric constants.
Color< T > operator+(const Color< T > &V1, const Color< T > &V2)
void set(const T &x1, const T &x2)
Mutator of the three dimension values of the Vector2d.
self operator-() const
Computes the oposite of a Vector2d.
const T & get_x1() const
Accessor to the first dimension value of the Vector2d.
Provides some algorithms to compare ranges.
bool operator>(const Array< T > &x, const Array< T > &y)
void set_y(const T &g)
Mutator of the second dimension value of the Vector2d.
slip::Vector2d< int > Vector2d_i
int alias
_Tp operator()(const slip::Vector2d< _Tp > &__x, const slip::Vector2d< _Tp > &__y) const
Provides a class to manipulate static and generic vectors.
T angle() const
Computes the angle with the cartesian axis. The result is between the range [-PI,PI].
slip::Vector2d< unsigned int > Vector2d_ui
unsigned int alias
Vector2d()
Default constructor init all the components to 0.
slip::Vector2d< double > Vector2d_d
double alias
friend class boost::serialization::access
const_pointer const_iterator
Provides some mathematical functors and constants.
HyperVolume< T > sqrt(const HyperVolume< T > &M)
ptrdiff_t difference_type
slip::Vector2d< float > Vector2d_f
float alias
const T & u() const
Accessor to the first dimension value of the Vector2d.
std::string name() const
Returns the name of the class.
_Tp operator()(const slip::Vector2d< _Tp > &__x, const slip::Vector2d< _Tp > &__y) const
This is a Vector2d struct. It is a specialization of kvector. It implements some peculiar 2d operatio...
slip::Vector2d< char > Vector2d_c
char alias
HyperVolume< T > acos(const HyperVolume< T > &M)
const T & get_x2() const
Accessor to the second dimension value of the Vector2d.
slip::Vector2d< unsigned char > Vector2d_uc
unsigned char alias
Computes the angular error usually used in optical flow estimation evaluations: where : ...
slip::Vector2d< long > Vector2d_l
long alias
const value_type & const_reference
const T & get_y() const
Accessor to the second dimension value of the Vector2d.
Color< T > operator*(const Color< T > &V1, const Color< T > &V2)
slip::Vector2d< unsigned long > Vector2d_ul
unsigned long alias
Computes the angular error usually used in optical flow estimation evaluations: where: ...
Color< T > operator/(const Color< T > &V1, const Color< T > &V2)
bool operator>=(const Array< T > &x, const Array< T > &y)
Color< T > operator-(const Color< T > &V1, const Color< T > &V2)
void set_x1(const T &x1)
Mutator of the first dimension value of the Vector2d.
Provides some algorithms to compute norms.
const value_type * const_pointer
slip::Vector2d< unsigned short > Vector2d_us
unsigned long alias