Skip to content

Commit

Permalink
Remove the rest of rescaling code
Browse files Browse the repository at this point in the history
  • Loading branch information
vissarion committed May 27, 2024
1 parent 5511f9e commit 20c0388
Show file tree
Hide file tree
Showing 25 changed files with 42 additions and 237 deletions.
3 changes: 1 addition & 2 deletions example/05_b_overlay_linestring_polygon_example.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,8 @@ int main(void)
using turn_info = bg::detail::overlay::turn_info<point_2d, segment_ratio>;
std::vector<turn_info> turns;
bg::detail::get_turns::no_interrupt_policy policy;
bg::detail::no_rescale_policy rescale_policy;
bg::strategies::relate::services::default_strategy<bg::model::linestring<point_2d>, bg::model::polygon<point_2d>>::type strategy;
bg::get_turns<false, false, bg::detail::overlay::assign_null_policy>(ls, p, strategy, rescale_policy, turns, policy);
bg::get_turns<false, false, bg::detail::overlay::assign_null_policy>(ls, p, strategy, turns, policy);

std::cout << "Intersection of linestring/polygon" << std::endl;
for (turn_info const& turn : turns)
Expand Down
3 changes: 1 addition & 2 deletions example/c05_custom_point_pointer_example.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,11 +102,10 @@ int main()

// This works because outputs to a normal struct point, no point*
typedef boost::geometry::model::linestring<point_2d> linestring_2d;
boost::geometry::detail::no_rescale_policy rescale_policy;
std::vector<linestring_2d> clipped;
boost::geometry::strategy::intersection::liang_barsky<box_2d, point_2d> strategy;
boost::geometry::detail::intersection::clip_range_with_box<linestring_2d>(cb,
myline, rescale_policy, std::back_inserter(clipped), strategy);
myline, std::back_inserter(clipped), strategy);


std::cout << boost::geometry::length(clipped.front()) << std::endl;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
#include <boost/geometry/geometries/helper_geometry.hpp>

#include <boost/geometry/policies/disjoint_interrupt_policy.hpp>
#include <boost/geometry/policies/robustness/no_rescale_policy.hpp>

#include <boost/geometry/algorithms/dispatch/disjoint.hpp>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@

#include <boost/geometry/algorithms/detail/overlay/self_turn_points.hpp>
#include <boost/geometry/policies/disjoint_interrupt_policy.hpp>
#include <boost/geometry/policies/robustness/no_rescale_policy.hpp>

#include <boost/geometry/strategies/relate/services.hpp>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
#include <boost/geometry/util/range.hpp>

#include <boost/geometry/policies/predicate_based_interrupt_policy.hpp>
#include <boost/geometry/policies/robustness/no_rescale_policy.hpp>
#include <boost/geometry/policies/robustness/segment_ratio.hpp>

#include <boost/geometry/algorithms/intersects.hpp>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
#include <boost/geometry/algorithms/detail/overlay/approximately_equals.hpp>
#include <boost/geometry/algorithms/detail/overlay/cluster_info.hpp>
#include <boost/geometry/algorithms/detail/overlay/get_ring.hpp>
#include <boost/geometry/policies/robustness/rescale_policy_tags.hpp>
#include <boost/range/value_type.hpp>
#include <boost/geometry/util/math.hpp>

Expand All @@ -28,7 +27,7 @@ namespace boost { namespace geometry
namespace detail { namespace overlay
{

template <typename Tag = no_rescale_policy_tag, bool Integral = false>
template <bool Integral = false>
struct sweep_equal_policy
{

Expand All @@ -54,7 +53,7 @@ struct sweep_equal_policy
};

template <>
struct sweep_equal_policy<no_rescale_policy_tag, true>
struct sweep_equal_policy<true>
{
template <typename P>
static inline bool equals(P const& p1, P const& p2)
Expand Down Expand Up @@ -98,7 +97,6 @@ inline void get_clusters(Turns& turns, Clusters& clusters)

sweep_equal_policy
<
no_rescale_policy,
std::is_integral<typename coordinate_type<point_type>::type>::value
> equal_policy;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@

#include <boost/geometry/algorithms/convert.hpp>
#include <boost/geometry/algorithms/detail/overlay/get_turns.hpp>
#include <boost/geometry/policies/robustness/rescale_policy_tags.hpp>

#include <boost/geometry/geometries/segment.hpp>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,8 @@ struct base_turn_handler
BOOST_GEOMETRY_ASSERT(index < info.count);

geometry::convert(info.intersections[index], ti.point);
ti.operations[0].fraction = info.fractions[index].robust_ra;
ti.operations[1].fraction = info.fractions[index].robust_rb;
ti.operations[0].fraction = info.fractions[index].ra;
ti.operations[1].fraction = info.fractions[index].rb;
}

template <typename TurnInfo, typename IntersectionInfo, typename DirInfo>
Expand Down Expand Up @@ -170,16 +170,16 @@ struct base_turn_handler
}
else
{
ti.operations[i].fraction = i == 0 ? info.fractions[index].robust_ra
: info.fractions[index].robust_rb;
ti.operations[i].fraction = i == 0 ? info.fractions[index].ra
: info.fractions[index].rb;
}
}
}

template <typename IntersectionInfo>
static inline unsigned int non_opposite_to_index(IntersectionInfo const& info)
{
return info.fractions[0].robust_rb < info.fractions[1].robust_rb
return info.fractions[0].rb < info.fractions[1].rb
? 1 : 0;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
#include <boost/geometry/algorithms/detail/equals/point_point.hpp>
#include <boost/geometry/algorithms/detail/overlay/get_turn_info.hpp>
#include <boost/geometry/core/assert.hpp>
#include <boost/geometry/policies/robustness/no_rescale_policy.hpp>

namespace boost { namespace geometry {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
#include <boost/geometry/algorithms/detail/overlay/turn_info.hpp>
#include <boost/geometry/core/assert.hpp>
#include <boost/geometry/policies/relate/intersection_policy.hpp>
#include <boost/geometry/policies/robustness/rescale_policy_tags.hpp>
#include <boost/geometry/strategies/intersection_result.hpp>

namespace boost { namespace geometry {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,6 @@

#include <boost/geometry/geometries/concepts/check.hpp>

#include <boost/geometry/policies/robustness/rescale_policy_tags.hpp>

#include <boost/geometry/strategies/default_strategy.hpp>
#include <boost/geometry/strategies/detail.hpp>
#include <boost/geometry/strategies/relate/services.hpp>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,6 @@

#include <boost/geometry/util/condition.hpp>

#include <boost/geometry/policies/robustness/no_rescale_policy.hpp>

namespace boost { namespace geometry
{

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,6 @@

#include <boost/geometry/geometries/helper_geometry.hpp>

#include <boost/geometry/policies/robustness/no_rescale_policy.hpp>

#include <boost/geometry/strategies/relate/cartesian.hpp>
#include <boost/geometry/strategies/relate/geographic.hpp>
#include <boost/geometry/strategies/relate/spherical.hpp>
Expand Down
45 changes: 0 additions & 45 deletions include/boost/geometry/policies/robustness/no_rescale_policy.hpp

This file was deleted.

73 changes: 0 additions & 73 deletions include/boost/geometry/policies/robustness/rescale_policy.hpp

This file was deleted.

43 changes: 0 additions & 43 deletions include/boost/geometry/policies/robustness/rescale_policy_tags.hpp

This file was deleted.

20 changes: 9 additions & 11 deletions include/boost/geometry/strategies/cartesian/intersection.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,6 @@
#include <boost/geometry/strategies/side_info.hpp>
#include <boost/geometry/strategies/within.hpp>

#include <boost/geometry/policies/robustness/rescale_policy_tags.hpp>


#if defined(BOOST_GEOMETRY_DEBUG_ROBUSTNESS)
# include <boost/geometry/io/wkt/write.hpp>
Expand Down Expand Up @@ -155,12 +153,12 @@ struct cartesian_segments
template <typename Point, typename Segment1, typename Segment2>
void assign_a(Point& point, Segment1 const& a, Segment2 const& ) const
{
assign(point, a, dx_a, dy_a, robust_ra);
assign(point, a, dx_a, dy_a, ra);
}
template <typename Point, typename Segment1, typename Segment2>
void assign_b(Point& point, Segment1 const& , Segment2 const& b) const
{
assign(point, b, dx_b, dy_b, robust_rb);
assign(point, b, dx_b, dy_b, rb);
}

template <typename Point, typename Segment>
Expand Down Expand Up @@ -237,7 +235,7 @@ struct cartesian_segments
<
std::is_arithmetic<CoordinateType>::value
>::apply(comparable_length_a(), comparable_length_b(),
robust_ra.edge_value(), robust_rb.edge_value());
ra.edge_value(), rb.edge_value());

if (use_a)
{
Expand All @@ -252,8 +250,8 @@ struct cartesian_segments
// Verify nearly collinear cases (the threshold is arbitrary
// but influences performance). If the intersection is located
// outside the segments, then it should be moved.
if (robust_ra.possibly_collinear(1.0e-3)
&& robust_rb.possibly_collinear(1.0e-3))
if (ra.possibly_collinear(1.0e-3)
&& rb.possibly_collinear(1.0e-3))
{
// The segments are nearly collinear and because of the calculation
// method with very small denominator, the IP appears outside the
Expand All @@ -268,8 +266,8 @@ struct cartesian_segments

CoordinateType dx_a, dy_a;
CoordinateType dx_b, dy_b;
SegmentRatio robust_ra;
SegmentRatio robust_rb;
SegmentRatio ra;
SegmentRatio rb;
};

template <typename D, typename W, typename ResultType>
Expand Down Expand Up @@ -498,8 +496,8 @@ struct cartesian_segments
}
else
{
sinfo.robust_ra.assign(nominator_a, denominator_a);
sinfo.robust_rb.assign(nominator_b, denominator_b);
sinfo.ra.assign(nominator_a, denominator_a);
sinfo.rb.assign(nominator_b, denominator_b);
}
}

Expand Down
Loading

0 comments on commit 20c0388

Please sign in to comment.