TuttleOFX
1
|
00001 #ifndef _TERRY_POINT_OPERATIONS_HPP_ 00002 #define _TERRY_POINT_OPERATIONS_HPP_ 00003 00004 #include <boost/gil/utilities.hpp> 00005 00006 00007 /// \ingroup PointModel 00008 template <typename T> 00009 GIL_FORCEINLINE 00010 boost::gil::point2<T> operator*( const boost::gil::point2<T>& p, const double t ) { return boost::gil::point2<T >( p.x * t, p.y * t ); } 00011 /// \ingroup PointModel 00012 template <typename T> 00013 GIL_FORCEINLINE 00014 boost::gil::point2<T>& operator*=( boost::gil::point2<T>& p, const double t ) { p.x *= t; p.y *= t; return p; } 00015 /// \ingroup PointModel 00016 template <typename T> 00017 GIL_FORCEINLINE 00018 boost::gil::point2<T> operator*( const boost::gil::point2<T>& a, const boost::gil::point2<T>& b ) { return boost::gil::point2<T>( a.x * b.x, a.y * b.y ); } 00019 /// \ingroup PointModel 00020 template <typename T> 00021 GIL_FORCEINLINE 00022 boost::gil::point2<T>& operator*=( boost::gil::point2<T>& a, const boost::gil::point2<T>& b ) { a.x *= b.x; a.y *= b.y; return a; } 00023 /// \ingroup PointModel 00024 template <typename T> 00025 GIL_FORCEINLINE 00026 boost::gil::point2<T> operator/( const boost::gil::point2<T>& a, const boost::gil::point2<T>& b ) { return boost::gil::point2<T>( a.x / b.x, a.y / b.y ); } 00027 /// \ingroup PointModel 00028 template <typename T> 00029 GIL_FORCEINLINE 00030 boost::gil::point2<double> operator/( const double t, const boost::gil::point2<T>& p ) 00031 { 00032 boost::gil::point2<double> res( 0, 0 ); 00033 if( p.x != 0 ) 00034 res.x = t / p.x; 00035 if( p.y != 0 ) 00036 res.y = t / p.y; 00037 return res; 00038 } 00039 00040 00041 #endif 00042