26 #ifndef MLN_WIN_BALL_HH
27 # define MLN_WIN_BALL_HH
33 # include <mln/core/internal/classical_window_base.hh>
34 # include <mln/core/dpoint.hh>
35 # include <mln/core/site_set/box.hh>
36 # include <mln/fun/i2v/all_to.hh>
43 namespace win {
template <
typename G,
typename C>
struct ball; }
49 template <
typename G,
typename C>
50 struct window_< mln::win::ball<G,C> > : classical_window_
70 template <
typename G,
typename C>
86 void print_(std::ostream& ostr)
const;
94 # ifndef MLN_INCLUDE_ONLY
97 template <
typename G,
typename C>
100 : diameter_(diameter)
102 mln_precondition(diameter % 2 == 1);
104 radius = diameter / 2,
105 sqr_radius = radius * radius;
108 P O = literal::origin;
113 for (
unsigned i = 0; i < P::dim; ++i)
120 template <
typename G,
typename C>
122 unsigned ball<G,C>::diameter()
const
127 template <
typename G,
typename C>
129 unsigned ball<G,C>::delta_()
const
131 return diameter_ / 2;
134 template <
typename G,
typename C>
137 ball<G,C>::print_(std::ostream& ostr)
const
139 ostr <<
"[" << G::dim <<
"D ball: diameter=" << diameter_ <<
']';
142 # endif // ! MLN_INCLUDE_ONLY
150 #endif // ! MLN_WIN_BALL_HH