Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
vissarion committed Dec 5, 2023
2 parents 600bac8 + fa36235 commit da14168
Show file tree
Hide file tree
Showing 111 changed files with 768 additions and 382 deletions.
12 changes: 12 additions & 0 deletions doc/release_notes.qbk
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,18 @@

[section:release_notes Release Notes]

[/=================]
[heading Boost 1.84]
[/=================]

[*Solved issues]

* [@https://github.com/boostorg/geometry/issues/1138 1138] Fix difference of two polygons
* [@https://github.com/boostorg/geometry/issues/1183 1183] Fix for union_ incomplete result polygon
* [@https://github.com/boostorg/geometry/issues/1184 1184] Fix for intersection
* [@https://github.com/boostorg/geometry/issues/1186 1186] Fix for union_ improper inner ring assignment
* Various fixes of errors and warnings

[/=================]
[heading Boost 1.83]
[/=================]
Expand Down
2 changes: 1 addition & 1 deletion include/boost/geometry/algorithms/assign.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ template <typename Geometry1, typename Geometry2>
struct assign
{
static inline void
apply(Geometry1& geometry1, const Geometry2& geometry2)
apply(Geometry1& geometry1, Geometry2 const& geometry2)
{
concepts::check<Geometry1>();
concepts::check<Geometry2 const>();
Expand Down
9 changes: 1 addition & 8 deletions include/boost/geometry/algorithms/centroid.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,16 +82,9 @@ class centroid_exception : public geometry::exception
{
public:

/*!
\brief The default constructor
*/
inline centroid_exception() {}

/*!
\brief Returns the explanatory string.
\return Pointer to a null-terminated string with explanatory information.
*/
virtual char const* what() const throw()
char const* what() const noexcept override
{
return "Boost.Geometry Centroid calculation exception";
}
Expand Down
1 change: 1 addition & 0 deletions include/boost/geometry/algorithms/correct_closure.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
#include <boost/geometry/geometries/concepts/check.hpp>

#include <boost/geometry/util/range.hpp>
#include <boost/range/size.hpp>

namespace boost { namespace geometry
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -698,7 +698,7 @@ struct buffered_piece_collection
BOOST_GEOMETRY_ASSERT(pc.offsetted_count >= 0);
}

inline void add_piece_point(piece& pc, const point_type& point, bool add_to_original)
inline void add_piece_point(piece& pc, point_type const& point, bool add_to_original)
{
if (add_to_original && pc.type != strategy::buffer::buffered_concave)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ struct line_line_intersection
// | pa pa |
// | qb qb |
auto const denominator_pq = determinant<line, &line::a, &line::b>(p, q);
constexpr decltype(denominator_pq) const zero = 0;
static decltype(denominator_pq) const zero = 0;

if (equidistant)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
#include <array>

#include <boost/core/addressof.hpp>
#include <boost/range/size.hpp>

#include <boost/geometry/core/assert.hpp>
#include <boost/geometry/core/config.hpp>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,9 @@


#include <boost/core/ignore_unused.hpp>
#include <boost/geometry/core/coordinate_type.hpp>
#include <boost/range/size.hpp>

#include <boost/geometry/core/coordinate_type.hpp>
#include <boost/geometry/algorithms/detail/buffer/buffer_policies.hpp>
#include <boost/geometry/algorithms/detail/disjoint/interface.hpp>
#include <boost/geometry/algorithms/expand.hpp>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@

#include <vector>

#include <boost/range/size.hpp>

#include <boost/geometry/algorithms/area.hpp>
#include <boost/geometry/core/point_order.hpp>
#include <boost/geometry/core/radian_access.hpp>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@

#include <boost/range/begin.hpp>
#include <boost/range/end.hpp>
#include <boost/range/size.hpp>

#include <boost/geometry/core/assert.hpp>
#include <boost/geometry/core/closure.hpp>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@

#include <iterator>

#include <boost/range/size.hpp>

#include <boost/geometry/algorithms/covered_by.hpp>
#include <boost/geometry/algorithms/detail/closest_points/range_to_geometry_rtree.hpp>
#include <boost/geometry/algorithms/detail/closest_points/utilities.hpp>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
#include <algorithm>
#include <vector>

#include <boost/range/size.hpp>

#include <boost/geometry/algorithms/detail/for_each_range.hpp>
#include <boost/geometry/core/assert.hpp>
#include <boost/geometry/core/closure.hpp>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@

#include <array>

#include <boost/range/size.hpp>

#include <boost/geometry/algorithms/detail/assign_box_corners.hpp>
#include <boost/geometry/algorithms/detail/convex_hull/graham_andrew.hpp>
#include <boost/geometry/algorithms/detail/equals/point_point.hpp>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
#define BOOST_GEOMETRY_ALGORITHMS_DETAIL_DISJOINT_LINEAR_SEGMENT_OR_BOX_HPP


#include <boost/range/size.hpp>

#include <boost/geometry/algorithms/detail/disjoint/multirange_geometry.hpp>
#include <boost/geometry/algorithms/dispatch/disjoint.hpp>
#include <boost/geometry/algorithms/not_implemented.hpp>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@

#include <vector>

#include <boost/range/size.hpp>

#include <boost/geometry/algorithms/dispatch/distance.hpp>
#include <boost/geometry/algorithms/detail/visit.hpp>
#include <boost/geometry/core/assert.hpp>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@


#include <boost/numeric/conversion/cast.hpp>
#include <boost/range/size.hpp>

#include <boost/geometry/algorithms/detail/normalize.hpp>
#include <boost/geometry/algorithms/not_implemented.hpp>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class overlay_invalid_input_exception : public geometry::exception

inline overlay_invalid_input_exception() {}

virtual char const* what() const throw()
char const* what() const noexcept override
{
return "Boost.Geometry Overlay invalid input exception";
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@


#include <boost/geometry/algorithms/detail/intersection/interface.hpp>
#include <boost/geometry/algorithms/detail/overlay/intersection_box_box.hpp>
#include <boost/geometry/algorithms/detail/intersection/box_box_implementation.hpp>


namespace boost { namespace geometry
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,11 @@
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)

#ifndef BOOST_GEOMETRY_ALGORITHMS_DETAIL_OVERLAY_INTERSECTION_BOX_BOX_HPP
#define BOOST_GEOMETRY_ALGORITHMS_DETAIL_OVERLAY_INTERSECTION_BOX_BOX_HPP
#ifndef BOOST_GEOMETRY_ALGORITHMS_DETAIL_INTERSECTION_BOX_BOX_IMPLEMENTATION_HPP
#define BOOST_GEOMETRY_ALGORITHMS_DETAIL_INTERSECTION_BOX_BOX_IMPLEMENTATION_HPP


#include <boost/geometry/core/access.hpp>
#include <boost/geometry/core/coordinate_type.hpp>


namespace boost { namespace geometry
Expand All @@ -42,18 +41,16 @@ struct intersection_box_box
BoxOut& box_out,
Strategy const& strategy)
{
typedef typename coordinate_type<BoxOut>::type ct;

ct max1 = get<max_corner, Dimension>(box1);
ct min2 = get<min_corner, Dimension>(box2);
auto max1 = get<max_corner, Dimension>(box1);
auto min2 = get<min_corner, Dimension>(box2);

if (max1 < min2)
{
return false;
}

ct max2 = get<max_corner, Dimension>(box2);
ct min1 = get<min_corner, Dimension>(box1);
auto max2 = get<max_corner, Dimension>(box2);
auto min1 = get<min_corner, Dimension>(box1);

if (max2 < min1)
{
Expand Down Expand Up @@ -93,4 +90,4 @@ struct intersection_box_box<DimensionCount, DimensionCount>
}} // namespace boost::geometry


#endif // BOOST_GEOMETRY_ALGORITHMS_DETAIL_OVERLAY_INTERSECTION_BOX_BOX_HPP
#endif // BOOST_GEOMETRY_ALGORITHMS_DETAIL_INTERSECTION_BOX_BOX_IMPLEMENTATION_HPP
2 changes: 2 additions & 0 deletions include/boost/geometry/algorithms/detail/intersection/gc.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@

#include <tuple>

#include <boost/range/size.hpp>

#include <boost/geometry/algorithms/detail/gc_make_rtree.hpp>
#include <boost/geometry/algorithms/detail/intersection/interface.hpp>
#include <boost/geometry/views/detail/geometry_collection_view.hpp>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
#include <boost/iterator/filter_iterator.hpp>
#include <boost/range/begin.hpp>
#include <boost/range/end.hpp>
#include <boost/range/size.hpp>
#include <boost/range/value_type.hpp>

#include <boost/geometry/core/exterior_ring.hpp>
Expand Down
5 changes: 3 additions & 2 deletions include/boost/geometry/algorithms/detail/is_valid/ring.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@

#include <deque>

#include <boost/range/size.hpp>

#include <boost/core/ignore_unused.hpp>

#include <boost/geometry/core/closure.hpp>
Expand All @@ -38,12 +40,11 @@
#include <boost/geometry/algorithms/detail/is_valid/has_valid_self_turns.hpp>
#include <boost/geometry/algorithms/dispatch/is_valid.hpp>

// TEMP - with UmberllaStrategy this will be not needed
// TEMP - with UmbrellaStrategy this will be not needed
#include <boost/geometry/strategy/area.hpp>
#include <boost/geometry/strategies/area/services.hpp>
// TODO: use point_order instead of area


#ifdef BOOST_GEOMETRY_TEST_DEBUG
#include <boost/geometry/io/dsv/write.hpp>
#endif
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ inline void append_no_dups_or_spikes(Range& range, Point const& point,
return;
}

auto append = [](auto& r, const auto& p)
auto append = [](auto& r, auto const& p)
{
using point_t = typename boost::range_value<Range>::type;
point_t rp;
Expand Down Expand Up @@ -168,56 +168,64 @@ inline void append_no_collinear(Range& range, Point const& point,
}
}

template <typename Range, typename Strategy, typename RobustPolicy>
inline void clean_closing_dups_and_spikes(Range& range,
Strategy const& strategy,
RobustPolicy const& robust_policy)
// Should only be called internally, from traverse.
template <typename Ring, typename Strategy, typename RobustPolicy>
inline void remove_spikes_at_closure(Ring& ring, Strategy const& strategy,
RobustPolicy const& robust_policy)
{
std::size_t const minsize
= core_detail::closure::minimum_ring_size
<
geometry::closure<Range>::value
>::value;

if (boost::size(range) <= minsize)
// It assumes a closed ring (whatever the closure value)
constexpr std::size_t min_size
= core_detail::closure::minimum_ring_size
<
geometry::closed
>::value;

if (boost::size(ring) < min_size)
{
// Don't act on too small rings.
return;
}

static bool const closed = geometry::closure<Range>::value == geometry::closed;

// TODO: the following algorithm could be rewritten to first look for spikes
// and then erase some number of points from the beginning of the Range

bool found = false;
do
{
found = false;
auto first = boost::begin(range);
auto second = first + 1;
auto ultimate = boost::end(range) - 1;
if (BOOST_GEOMETRY_CONDITION(closed))
{
ultimate--;
}
auto const first = boost::begin(ring);
auto const second = first + 1;
auto const penultimate = boost::end(ring) - 2;

// Check if closing point is a spike (this is so if the second point is
// considered as collinear w.r.t. the last segment)
if (point_is_collinear(*second, *ultimate, *first,
if (point_is_collinear(*second, *penultimate, *first,
strategy.side(), // TODO: Pass strategy?
robust_policy))
{
range::erase(range, first);
if (BOOST_GEOMETRY_CONDITION(closed))
{
// Remove closing last point
range::resize(range, boost::size(range) - 1);
// Add new closing point
range::push_back(range, range::front(range));
}
// Remove first point and last point
range::erase(ring, first);
range::resize(ring, boost::size(ring) - 1);
// Close the ring again
range::push_back(ring, range::front(ring));

found = true;
}
} while(found && boost::size(range) > minsize);
} while (found && boost::size(ring) >= min_size);
}

template <typename Ring, typename Strategy>
inline void fix_closure(Ring& ring, Strategy const& strategy)
{
if (BOOST_GEOMETRY_CONDITION(geometry::closure<Ring>::value == geometry::open))
{
if (! boost::empty(ring)
&& detail::equals::equals_point_point(range::front(ring), range::back(ring), strategy))
{
// Correct closure: traversal automatically closes rings.
// Depending on the geometric configuration,
// remove_spikes_at_closure can remove the closing point.
// But it does not always do that. Therefore it is corrected here explicitly.
range::resize(ring, boost::size(ring) - 1);
}
}
}


Expand Down
Loading

0 comments on commit da14168

Please sign in to comment.