Skip to content

Commit

Permalink
[extensions] Remove rescaling code
Browse files Browse the repository at this point in the history
  • Loading branch information
vissarion committed May 22, 2024
1 parent a7644cb commit b3c0120
Show file tree
Hide file tree
Showing 74 changed files with 393 additions and 1,258 deletions.
81 changes: 22 additions & 59 deletions include/boost/geometry/algorithms/detail/buffer/buffer_inserter.hpp

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ public :
typename Turns,
typename Geometry,
typename Strategy,
typename RobustPolicy,
typename Visitor
>
static inline void apply(std::size_t size_at_start,
Expand All @@ -59,7 +58,6 @@ public :
Geometry const& ,
Geometry const& ,
Strategy const& ,
RobustPolicy const& ,
state_type& state,
Visitor& /*visitor*/
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,7 @@ template
<
typename Ring,
typename Strategy,
typename DistanceStrategy,
typename RobustPolicy
typename DistanceStrategy
>
struct buffered_piece_collection
{
Expand All @@ -135,13 +134,13 @@ struct buffered_piece_collection
typedef buffer_turn_info
<
point_type,
typename segment_ratio_type<point_type, RobustPolicy>::type
typename segment_ratio_type<point_type>::type
> buffer_turn_info_type;

typedef buffer_turn_operation
<
point_type,
typename segment_ratio_type<point_type, RobustPolicy>::type
typename segment_ratio_type<point_type>::type
> buffer_turn_operation_type;

typedef std::vector<buffer_turn_info_type> turn_vector_type;
Expand Down Expand Up @@ -228,7 +227,7 @@ struct buffered_piece_collection
geometry::sectionalize
<
false, dimensions
>(m_ring, detail::no_rescale_policy(), m_sections, strategy);
>(m_ring, m_sections, strategy);
}

clockwise_ring_type m_ring;
Expand Down Expand Up @@ -262,7 +261,7 @@ struct buffered_piece_collection
// which is using rescaling.
typedef geometry::model::box
<
typename geometry::robust_point_type<point_type, RobustPolicy>::type
typename geometry::robust_point_type<point_type>::type
> robust_box_type;
typedef geometry::sections <robust_box_type, 2> robust_sections_type;
robust_sections_type monotonic_sections;
Expand All @@ -278,17 +277,14 @@ struct buffered_piece_collection

Strategy m_strategy;
DistanceStrategy m_distance_strategy;
RobustPolicy const& m_robust_policy;

buffered_piece_collection(Strategy const& strategy,
DistanceStrategy const& distance_strategy,
RobustPolicy const& robust_policy)
DistanceStrategy const& distance_strategy)
: m_first_piece_index(-1)
, m_deflate(false)
, m_has_deflated(false)
, m_strategy(strategy)
, m_distance_strategy(distance_strategy)
, m_robust_policy(robust_policy)
{}

inline void check_linear_endpoints(buffer_turn_info_type& turn) const
Expand Down Expand Up @@ -434,10 +430,8 @@ struct buffered_piece_collection
piece_vector_type,
buffered_ring_collection<buffered_ring<Ring> >,
turn_vector_type,
Strategy,
RobustPolicy
> visitor(m_pieces, offsetted_rings, m_turns,
m_strategy, m_robust_policy);
Strategy
> visitor(m_pieces, offsetted_rings, m_turns, m_strategy);

detail::sectionalize::enlarge_sections(monotonic_sections, m_strategy);

Expand Down Expand Up @@ -706,7 +700,6 @@ struct buffered_piece_collection
sectionalizer::apply(monotonic_sections,
boost::begin(ring) + pc.first_seg_id.segment_index,
boost::begin(ring) + pc.beyond_last_segment_index,
m_robust_policy,
m_strategy,
ring_id, 10);
}
Expand Down Expand Up @@ -885,7 +878,7 @@ struct buffered_piece_collection
<
false, false, overlay_buffer,
ring_collection_t, ring_collection_t
>(m_turns, m_clusters, m_robust_policy))
>(m_turns, m_clusters))
{
return;
}
Expand Down Expand Up @@ -937,9 +930,7 @@ struct buffered_piece_collection
inline void enrich()
{
enrich_intersection_points<false, false, overlay_buffer>(m_turns,
m_clusters, offsetted_rings, offsetted_rings,
m_robust_policy,
m_strategy);
m_clusters, offsetted_rings, offsetted_rings, m_strategy);
}

// Discards all rings which do have not-OK intersection points only.
Expand Down Expand Up @@ -1054,7 +1045,7 @@ struct buffered_piece_collection
traversed_rings.clear();
buffer_overlay_visitor visitor;
traverser::apply(offsetted_rings, offsetted_rings,
m_strategy, m_robust_policy,
m_strategy,
m_turns, traversed_rings,
turn_info_per_ring,
m_clusters, visitor);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,16 +117,14 @@ template
typename Pieces,
typename Rings,
typename Turns,
typename Strategy,
typename RobustPolicy
typename Strategy
>
class piece_turn_visitor
{
Pieces const& m_pieces;
Rings const& m_rings;
Turns& m_turns;
Strategy const& m_strategy;
RobustPolicy const& m_robust_policy;

template <typename Piece>
inline bool is_adjacent(Piece const& piece1, Piece const& piece2) const
Expand Down Expand Up @@ -161,8 +159,7 @@ class piece_turn_visitor
&& it_begin + 1 != it_beyond
&& detail::section::preceding<Dimension>(dir, *(it_begin + 1),
this_bounding_box,
other_bounding_box,
m_robust_policy);
other_bounding_box);
++it_begin, index++)
{}
}
Expand All @@ -177,7 +174,7 @@ class piece_turn_visitor
&& it_beyond - 2 != it_begin)
{
if (detail::section::exceeding<Dimension>(dir, *(it_beyond - 2),
this_bounding_box, other_bounding_box, m_robust_policy))
this_bounding_box, other_bounding_box))
{
--it_beyond;
}
Expand Down Expand Up @@ -271,7 +268,6 @@ class piece_turn_visitor
turn_policy::apply(unique_sub_range1, unique_sub_range2,
the_model,
m_strategy,
m_robust_policy,
std::back_inserter(m_turns));
}
}
Expand All @@ -282,13 +278,11 @@ class piece_turn_visitor
piece_turn_visitor(Pieces const& pieces,
Rings const& ring_collection,
Turns& turns,
Strategy const& strategy,
RobustPolicy const& robust_policy)
Strategy const& strategy)
: m_pieces(pieces)
, m_rings(ring_collection)
, m_turns(turns)
, m_strategy(strategy)
, m_robust_policy(robust_policy)
{}

template <typename Section>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,11 +78,6 @@ struct buffer_all<Input, Output, TagIn, multi_polygon_tag>
typedef typename boost::range_value<Output>::type polygon_type;

typedef typename point_type<Input>::type point_type;
typedef typename rescale_policy_type
<
point_type,
typename geometry::cs_tag<point_type>::type
>::type rescale_policy_type;

if (geometry::is_empty(geometry_in))
{
Expand All @@ -94,19 +89,14 @@ struct buffer_all<Input, Output, TagIn, multi_polygon_tag>
geometry::envelope(geometry_in, box);
geometry::buffer(box, box, distance_strategy.max_distance(join_strategy, end_strategy));

rescale_policy_type rescale_policy
= boost::geometry::get_rescale_policy<rescale_policy_type>(
box, strategies);

detail::buffer::buffer_inserter<polygon_type>(geometry_in,
range::back_inserter(geometry_out),
distance_strategy,
side_strategy,
join_strategy,
end_strategy,
point_strategy,
strategies,
rescale_policy);
strategies);
}
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ struct disjoint_linear
Geometry1, Geometry2, assign_disjoint_policy
>
>::apply(0, geometry1, 1, geometry2,
strategy, detail::no_rescale_policy(), turns, interrupt_policy);
strategy, turns, interrupt_policy);

return !interrupt_policy.has_intersections;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,17 +67,16 @@ namespace detail { namespace overlay
{


template <typename Geometry, typename Strategy, typename RobustPolicy>
template <typename Geometry, typename Strategy>
inline bool has_self_intersections(Geometry const& geometry,
Strategy const& strategy,
RobustPolicy const& robust_policy,
bool throw_on_self_intersection = true)
{
typedef typename point_type<Geometry>::type point_type;
typedef turn_info
<
point_type,
typename segment_ratio_type<point_type, RobustPolicy>::type
typename segment_ratio_type<point_type>::type
> turn_info;
std::deque<turn_info> turns;
detail::disjoint::disjoint_interrupt_policy policy;
Expand All @@ -86,7 +85,7 @@ inline bool has_self_intersections(Geometry const& geometry,
<
false,
detail::overlay::assign_null_policy
>(geometry, strategy, robust_policy, turns, policy, 0, false);
>(geometry, strategy, turns, policy, 0, false);

#ifdef BOOST_GEOMETRY_DEBUG_HAS_SELF_INTERSECTIONS
bool first = true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,10 @@ struct intersection_areal_areal_
<
typename Areal1,
typename Areal2,
typename RobustPolicy,
typename Strategy
>
static inline void apply(Areal1 const& areal1,
Areal2 const& areal2,
RobustPolicy const& robust_policy,
GeometryOut& geometry_out,
Strategy const& strategy)
{
Expand All @@ -54,7 +52,7 @@ struct intersection_areal_areal_
Areal1, Areal2,
typename boost::range_value<GeometryOut>::type,
overlay_intersection
>::apply(areal1, areal2, robust_policy,
>::apply(areal1, areal2,
geometry::range::back_inserter(geometry_out),
strategy);
}
Expand All @@ -69,12 +67,10 @@ struct intersection_areal_areal_<TupledOut, tupled_output_tag>
<
typename Areal1,
typename Areal2,
typename RobustPolicy,
typename Strategy
>
static inline void apply(Areal1 const& areal1,
Areal2 const& areal2,
RobustPolicy const& robust_policy,
TupledOut& geometry_out,
Strategy const& strategy)
{
Expand Down Expand Up @@ -110,11 +106,8 @@ struct intersection_areal_areal_<TupledOut, tupled_output_tag>
areal::index, TupledOut
>::type areal_out_type;

// NOTE: The same robust_policy is used in each call of
// intersection_insert. Is that correct?

// A * A -> A
call_intersection(areal1, areal2, robust_policy,
call_intersection(areal1, areal2,
areal::get(geometry_out),
strategy);

Expand All @@ -124,7 +117,6 @@ struct intersection_areal_areal_<TupledOut, tupled_output_tag>
// L * L -> (L, P)
call_intersection(geometry::detail::boundary_view<Areal1 const>(areal1),
geometry::detail::boundary_view<Areal2 const>(areal2),
robust_policy,
! is_areal_empty
? temp_out
: geometry_out,
Expand All @@ -144,14 +136,12 @@ struct intersection_areal_areal_<TupledOut, tupled_output_tag>
// L - L -> L
call_difference(linear::get(temp_out),
areal_out_boundary,
robust_policy,
linear::get(geometry_out),
strategy);

// P - L -> P
call_difference(pointlike::get(temp_out),
areal_out_boundary,
robust_policy,
pointlike::get(geometry_out),
strategy);
}
Expand All @@ -164,13 +154,11 @@ struct intersection_areal_areal_<TupledOut, tupled_output_tag>
<
typename Geometry1,
typename Geometry2,
typename RobustPolicy,
typename GeometryOut,
typename Strategy
>
static inline void call_intersection(Geometry1 const& geometry1,
Geometry2 const& geometry2,
RobustPolicy const& robust_policy,
GeometryOut& geometry_out,
Strategy const& strategy)
{
Expand All @@ -185,7 +173,6 @@ struct intersection_areal_areal_<TupledOut, tupled_output_tag>
overlay_intersection
>::apply(geometry1,
geometry2,
robust_policy,
geometry::detail::output_geometry_back_inserter(geometry_out),
strategy);
}
Expand All @@ -194,13 +181,11 @@ struct intersection_areal_areal_<TupledOut, tupled_output_tag>
<
typename Geometry1,
typename Geometry2,
typename RobustPolicy,
typename GeometryOut,
typename Strategy
>
static inline void call_difference(Geometry1 const& geometry1,
Geometry2 const& geometry2,
RobustPolicy const& robust_policy,
GeometryOut& geometry_out,
Strategy const& strategy)
{
Expand All @@ -212,7 +197,6 @@ struct intersection_areal_areal_<TupledOut, tupled_output_tag>
overlay_difference
>::apply(geometry1,
geometry2,
robust_policy,
geometry::range::back_inserter(geometry_out),
strategy);
}
Expand All @@ -225,20 +209,18 @@ struct intersection_areal_areal
<
typename Areal1,
typename Areal2,
typename RobustPolicy,
typename GeometryOut,
typename Strategy
>
static inline bool apply(Areal1 const& areal1,
Areal2 const& areal2,
RobustPolicy const& robust_policy,
GeometryOut& geometry_out,
Strategy const& strategy)
{
intersection_areal_areal_
<
GeometryOut
>::apply(areal1, areal2, robust_policy, geometry_out, strategy);
>::apply(areal1, areal2, geometry_out, strategy);

return true;
}
Expand Down
Loading

0 comments on commit b3c0120

Please sign in to comment.