31 #ifndef SCRIBO_PRIMITIVE_LINK_MERGE_DOUBLE_LINK_CLOSEST_ALIGNED_HH
32 # define SCRIBO_PRIMITIVE_LINK_MERGE_DOUBLE_LINK_CLOSEST_ALIGNED_HH
35 # include <mln/util/couple.hh>
36 # include <scribo/core/macros.hh>
37 # include <scribo/core/object_links.hh>
38 # include <scribo/core/tag/anchor.hh>
39 # include <scribo/filter/internal/alignment_angle.hh>
62 const object_links<L>& right,
63 anchor::Type anchor_angle);
65 # ifndef MLN_INCLUDE_ONLY
70 const object_links<L>& right,
71 anchor::Type anchor_angle)
73 mln_trace(
"scribo::primitive::link::merge_double_link_closest_aligned");
74 mln_precondition(left.is_valid());
75 mln_precondition(right.is_valid());
78 const component_set<L>&
components = left.components();
81 align_data.
resize(value::next(left.nelements()));
82 for (
unsigned i = 0; i < align_data.
nelements(); ++i)
84 align_data(i).first() = mln_max(
unsigned);
85 align_data(i).second() = 360;
88 object_links<L> output = right.duplicate();
91 for_all_links(l, output)
102 align_data(l).second()
103 = filter::internal::alignment_angle(components,
111 align_data(l).first() = mln_max(
unsigned);
114 align_data(l).second() = 360.f;
120 for_all_links(l, left)
121 if (left(l) != l && left(l) != right(l))
127 = filter::internal::alignment_angle(components,
132 if (right(left(l)) == left(l))
134 output.update(left(l), l);
136 else if ((dh < align_data(left(l)).first() * 0.66f)
137 || (alpha < align_data(left(l)).second()))
139 output.update(left(l), l);
140 align_data(left(l)).first() = dh;
141 align_data(left(l)).second() = alpha;
148 # endif // ! MLN_INCLUDE_ONLY
156 #endif // ! SCRIBO_PRIMITIVE_LINK_MERGE_DOUBLE_LINK_CLOSEST_ALIGNED_HH