27 #ifndef SCRIBO_PRIMITIVE_LINK_INTERNAL_LINK_SINGLE_DMAX_BASE_HH_
28 # define SCRIBO_PRIMITIVE_LINK_INTERNAL_LINK_SINGLE_DMAX_BASE_HH_
36 # include <mln/accu/center.hh>
37 # include <mln/labeling/compute.hh>
38 # include <mln/math/abs.hh>
39 # include <mln/util/array.hh>
41 # include <scribo/core/macros.hh>
42 # include <scribo/core/tag/anchor.hh>
43 # include <scribo/core/component_set.hh>
44 # include <scribo/core/object_links.hh>
46 # include <scribo/primitive/link/internal/find_link.hh>
47 # include <scribo/primitive/link/internal/compute_anchor.hh>
48 # include <scribo/primitive/link/internal/link_functor_base.hh>
50 # include <scribo/primitive/link/compute.hh>
68 template <
typename L,
typename E>
77 typedef mln_site(L) P;
80 unsigned neighb_max_distance,
81 anchor::Direction direction);
84 bool verify_link_criterion_(
unsigned current_object,
85 const P& start_point,
const P&
p,
86 anchor::Type anchor)
const;
88 void start_processing_object_(
unsigned current_object);
92 float neighb_max_distance_;
93 anchor::Direction direction_;
97 # ifndef MLN_INCLUDE_ONLY
100 template <
typename L,
typename E>
104 unsigned neighb_max_distance,
105 anchor::Direction direction)
107 : super_(components),
109 neighb_max_distance_(neighb_max_distance),
110 direction_(direction)
115 template <
typename L,
typename E>
118 link_single_dmax_base<L, E>::verify_link_criterion_(
119 unsigned current_object,
120 const P& start_point,
122 anchor::Type anchor)
const
124 (void) current_object;
127 float dist =
math::abs(p[direction_] - start_point[direction_]);
128 return dist <= dmax_;
132 template <
typename L,
typename E>
135 link_single_dmax_base<L, E>::start_processing_object_(
136 unsigned current_object)
139 midcol = (this->components_(current_object).bbox().pmax()[direction_]
140 - this->components_(current_object).bbox().pmin()[direction_]) / 2;
141 dmax_ = midcol + neighb_max_distance_;
145 # endif // ! MLN_INCLUDE_ONLY
157 #endif // SCRIBO_PRIMITIVE_LINK_INTERNAL_LINK_SINGLE_DMAX_BASE_HH_