1 #ifndef __stir_BasicCoordinate_H__ 2 #define __stir_BasicCoordinate_H__ 34 #include <boost/operators.hpp> 52 template <
int num_dimensions,
typename coordT>
55 boost::equality_comparable<BasicCoordinate<num_dimensions, coordT>
62 typedef std::random_access_iterator_tag iterator_category;
63 typedef coordT value_type;
64 typedef value_type& reference;
65 typedef const value_type& const_reference;
66 typedef value_type* iterator;
67 typedef value_type* pointer;
68 typedef const value_type* const_iterator;
69 typedef std::ptrdiff_t difference_type;
70 typedef std::size_t size_type;
87 template <
typename coordT2>
90 for (
int i = 1; i <= num_dimensions; ++i)
91 (*
this)[i] =
static_cast<coordT
>(c[i]);
110 inline coordT& operator[](
const int d);
118 inline coordT
const& operator[](
const int d)
const;
121 inline coordT& at(
const int d);
124 inline coordT
const& at(
const int d)
const;
127 inline bool empty()
const 134 inline static int get_min_index();
135 inline static int get_max_index();
136 inline static unsigned size();
138 inline void fill(
const coordT&);
173 inline iterator begin();
174 inline const_iterator begin()
const;
175 inline iterator end();
176 inline const_iterator end()
const;
182 coordT coords[num_dimensions];
210 inline BasicCoordinate<5, T> make_coordinate(
const T& a1,
const T& a2,
const T& a3,
const T& a4,
const T& a5);
213 inline BasicCoordinate<6, T> make_coordinate(
const T& a1,
const T& a2,
const T& a3,
const T& a4,
const T& a5,
const T& a6);
225 template <
int num_dimensions,
typename coordT>
231 template <
int num_dimensions,
typename coordT>
237 template <
int num_dimensions,
typename coordT>
243 template <
int num_dimensions,
typename coordT>
250 template <
int num_dimensions,
typename coordT>
257 template <
int num_dimensions,
typename coordT>
262 template <
int num_dimensions,
class coordT>
267 template <
int num_dimensions,
class coordT>
272 template <
int num_dimensions,
typename coordT>
277 template <
int num_dimensions>
BasicCoordinate< num_dimensions, float > convert_int_to_float(const BasicCoordinate< num_dimensions, int > &cint)
converts a BasicCoordinate<int> to BasicCoordinate<float>
Definition: BasicCoordinate.inl:486
BasicCoordinate< num_dimensions+1, coordT > join(const BasicCoordinate< num_dimensions, coordT > &c, const coordT &a)
make a longer BasicCoordinate, by appending the coordT to c
Definition: BasicCoordinate.inl:466
BasicCoordinate< num_dimensions - 1, coordT > cut_last_dimension(const BasicCoordinate< num_dimensions, coordT > &c)
make a shorter BasicCoordinate, by cutting the last element from c
Definition: BasicCoordinate.inl:458
double angle(const BasicCoordinate< num_dimensions, coordT > &p1, const BasicCoordinate< num_dimensions, coordT > &p2)
compute angle between 2 directions
Definition: BasicCoordinate.inl:440
BasicCoordinate< num_dimensions - 1, coordT > cut_first_dimension(const BasicCoordinate< num_dimensions, coordT > &c)
make a shorter BasicCoordinate, by cutting the first element from c
Definition: BasicCoordinate.inl:477
BasicCoordinate(const BasicCoordinate< num_dimensions, coordT2 > &c)
constructor from different type of coordT
Definition: BasicCoordinate.h:88
double norm_squared(const BasicCoordinate< num_dimensions, coordT > &p1)
compute (inner_product(p1,p1))
Definition: BasicCoordinate.inl:415
coordT inner_product(const BasicCoordinate< num_dimensions, coordT > &p1, const BasicCoordinate< num_dimensions, coordT > &p2)
compute sum_i p1[i] * p2[i]
Definition: BasicCoordinate.inl:408
double cos_angle(const BasicCoordinate< num_dimensions, coordT > &p1, const BasicCoordinate< num_dimensions, coordT > &p2)
compute cos of the angle between 2 directions
Definition: BasicCoordinate.inl:433
double norm(const BasicCoordinate< num_dimensions, coordT > &p1)
compute sqrt(inner_product(p1,p1))
Definition: BasicCoordinate.inl:426
class BasicCoordinate<int num_dimensions, typename coordT> defines num_dimensions -dimensional coordi...
Definition: BasicCoordinate.h:53
basic configuration include file
(inline) implementations for stir::BasicCoordinate
Boost class to define all comparison operators given only 2 (see operators.hpp)
Definition: doxygen_doc_for_boost.h:57