00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00023
00024 #ifndef BTK_MATH_BTK_VECTOR_HPP
00025 #define BTK_MATH_BTK_VECTOR_HPP
00026
00027 #include <ostream>
00028
00029 #include <boost/numeric/ublas/vector.hpp>
00030 #include <boost/numeric/ublas/io.hpp>
00031
00032 #include <btk/core/math/common_functions.hpp>
00033
00034 namespace uBLAS = boost::numeric::ublas;
00035
00036 namespace BTK {
00037 namespace MATH {
00038
00039 class BTKVector : public uBLAS::vector<double, uBLAS::bounded_array<double,3> >
00040 {
00041 public:
00042 typedef uBLAS::vector<double, uBLAS::bounded_array<double,3> > base_vector;
00043
00045 BTKVector() : base_vector(3) {}
00046
00048 BTKVector(double val) : base_vector(3)
00049 {
00050 this->operator[](0) = val;
00051 this->operator[](1) = val;
00052 this->operator[](2) = val;
00053 }
00054
00056 BTKVector(BTKVector const & src) : base_vector(src) {}
00057
00059 BTKVector(double x, double y, double z) : base_vector(3) {
00060 this->operator[](0) = x;
00061 this->operator[](1) = y;
00062 this->operator[](2) = z;
00063 }
00064
00066 template <class E>
00067 BTKVector(uBLAS::vector_expression<E> const & e) : base_vector(e) {}
00068
00069 virtual ~BTKVector() {}
00070
00072 template <class E>
00073 BTKVector & operator=(uBLAS::vector_expression<E> const & e) {
00074 base_vector::operator=(e);
00075 return *this;
00076 }
00077
00079 BTKVector & operator=(BTKVector const & rhs) {
00080 base_vector::operator=(static_cast<base_vector>(rhs));
00081 return *this;
00082 }
00083
00084 bool operator==(BTKVector const & rhs) const {
00085 return (BTK::MATH::equivalent(this->operator[](0),rhs[0]) &&
00086 BTK::MATH::equivalent(this->operator[](1),rhs[1]) &&
00087 BTK::MATH::equivalent(this->operator[](2),rhs[2]));
00088 }
00089
00090 bool operator!=(BTKVector const & rhs) const {
00091 return !(*this == rhs);
00092 }
00093
00094 };
00095
00096 }
00097 }
00098
00099 #endif // BTK_MATH_BTK_VECTOR_HPP