9 #ifndef IMPALGEBRA_MACROS_H
10 #define IMPALGEBRA_MACROS_H
12 #include <boost/range/iterator_range.hpp>
15 #define IMP_ALGEBRA_VECTOR_SWIG_METHODS(D) VectorD(const Floats &f);
17 #define IMP_ALGEBRA_VECTOR_SWIG_METHODS(D) \
19 VectorD &operator=(const R &o) { \
26 #define IMP_ALGEBRA_VECTOR_METHODS(D) \
27 typedef VectorBaseD<D> P; \
31 template <class Range> \
32 explicit VectorD(const Range &r) \
35 VectorD(const VectorD<OD> &o) \
37 BOOST_STATIC_ASSERT(OD == D || OD == -1 || D == -1); \
39 IMP_ALGEBRA_VECTOR_SWIG_METHODS(D); \
44 : P(boost::make_iterator_range(b, e)) {} \
46 VectorD get_unit_vector() const { return algebra::get_unit_vector(*this); } \
47 VectorD operator*(double s) const { \
52 VectorD operator/(double s) const { \
57 VectorD operator-() const { \
62 VectorD operator-(const VectorD &o) const { \
67 VectorD operator+(VectorD ret) const { \
71 VectorD &operator+=(const VectorD &o) { \
75 VectorD &operator-=(const VectorD &o) { \
79 VectorD &operator/=(double f) { \
83 VectorD &operator*=(double f) { \
88 double operator*(const VectorD &o) const { return P::operator*(o); }
Various important macros for implementing geometry.