27 #ifndef SCRIBO_PRIMITIVE_LINK_INTERNAL_LINK_SINGLE_DMAX_RATIO_BASE_HH_
28 # define SCRIBO_PRIMITIVE_LINK_INTERNAL_LINK_SINGLE_DMAX_RATIO_BASE_HH_
36 # include <mln/accu/center.hh>
37 # include <mln/labeling/compute.hh>
38 # include <mln/math/abs.hh>
39 # include <mln/math/max.hh>
40 # include <mln/util/array.hh>
42 # include <scribo/core/macros.hh>
43 # include <scribo/core/tag/anchor.hh>
44 # include <scribo/core/component_set.hh>
45 # include <scribo/core/object_links.hh>
47 # include <scribo/core/concept/dmax_functor.hh>
49 # include <scribo/primitive/link/internal/compute_anchor.hh>
50 # include <scribo/primitive/link/internal/find_link.hh>
51 # include <scribo/primitive/link/internal/link_functor_base.hh>
53 # include <scribo/primitive/link/compute.hh>
71 template <
typename L,
typename F,
typename E>
80 typedef mln_site(L) P;
83 anchor::Direction direction,
88 bool verify_link_criterion_(
unsigned current_object,
89 const P& start_point,
const P&
p,
90 anchor::Type anchor)
const;
92 mln_site(L) start_point_(
unsigned current_object,
95 void start_processing_object_(
unsigned current_object);
100 anchor::Direction direction_;
104 # ifndef MLN_INCLUDE_ONLY
107 template <
typename L,
typename F,
typename E>
111 anchor::Direction direction,
114 : super_(components),
115 dmax_f_(
exact(dmax_f)),
117 direction_(direction)
121 template <
typename L,
typename F,
typename E>
124 link_single_dmax_ratio_base<L, F, E>::verify_link_criterion_(
125 unsigned current_object,
126 const P& start_point,
128 anchor::Type anchor)
const
130 (void) current_object;
133 float dist =
math::abs(p[direction_] - start_point[direction_]);
134 return dist <= dmax_;
138 template <
typename L,
typename F,
typename E>
141 link_single_dmax_ratio_base<L, F, E>::start_point_(
unsigned current_object,
144 return internal::compute_anchor(this->components_,
145 current_object, anchor);
149 template <
typename L,
typename F,
typename E>
152 link_single_dmax_ratio_base<L, F, E>::start_processing_object_(
153 unsigned current_object)
155 dmax_ = dmax_f_(this->components_.info(current_object).bbox());
179 # endif // ! MLN_INCLUDE_ONLY
191 #endif // SCRIBO_PRIMITIVE_LINK_INTERNAL_LINK_SINGLE_DMAX_RATIO_BASE_HH_