Skip to content

Commit 2ef239c

Browse files
committed
Merge branch 'develop'
2 parents cda019d + 51a919d commit 2ef239c

29 files changed

+377
-131
lines changed

include/boost/geometry/algorithms/detail/overlay/check_enrich.hpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
#include <cstddef>
2222
#include <vector>
2323

24+
#include <boost/core/ignore_unused.hpp>
2425
#include <boost/range/begin.hpp>
2526
#include <boost/range/end.hpp>
2627
#include <boost/range/value_type.hpp>
@@ -66,6 +67,8 @@ inline void display(MetaTurn const& meta_turn, const char* reason = "")
6667
//<< " -> " << op_index
6768
<< " " << reason
6869
<< std::endl;
70+
#else
71+
boost::ignore_unused(meta_turn, reason);
6972
#endif
7073
}
7174

include/boost/geometry/strategies/geographic/distance_cross_track_box_box.hpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -189,8 +189,7 @@ struct result_from_distance
189189

190190
public:
191191
template <typename T>
192-
static inline return_type apply(this_strategy const& strategy,
193-
T const& distance)
192+
static inline return_type apply(this_strategy const& , T const& distance)
194193
{
195194
return static_cast<return_type>(distance);
196195
}

include/boost/geometry/strategies/normalize.hpp

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
// Boost.Geometry (aka GGL, Generic Geometry Library)
22

3-
// Copyright (c) 2015-2020, Oracle and/or its affiliates.
3+
// Copyright (c) 2015-2025, Oracle and/or its affiliates.
44

5+
// Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle
56
// Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle
67
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
78

@@ -123,7 +124,7 @@ struct assign_loop<1, DimensionCount>
123124
template <typename PointIn, typename PointOut, bool IsEquatorial = true>
124125
struct normalize_point
125126
{
126-
static inline void apply(PointIn const& point_in, PointOut& point_out)
127+
static inline void apply(PointIn const& point_in, PointOut& point_out, bool exact = true)
127128
{
128129
using in_coordinate_type = coordinate_type_t<PointIn>;
129130

@@ -135,7 +136,7 @@ struct normalize_point
135136
typename geometry::detail::cs_angular_units<PointIn>::type,
136137
IsEquatorial,
137138
in_coordinate_type
138-
>(longitude, latitude);
139+
>(longitude, latitude, exact);
139140

140141
assign_loop
141142
<
@@ -221,13 +222,13 @@ struct cartesian_box
221222
struct spherical_point
222223
{
223224
template <typename PointIn, typename PointOut>
224-
static inline void apply(PointIn const& point_in, PointOut& point_out)
225+
static inline void apply(PointIn const& point_in, PointOut& point_out, bool exact = true)
225226
{
226227
detail::normalize_point
227228
<
228229
PointIn, PointOut,
229230
(! std::is_same<cs_tag_t<PointIn>, spherical_polar_tag>::value)
230-
>::apply(point_in, point_out);
231+
>::apply(point_in, point_out, exact);
231232
}
232233
};
233234

include/boost/geometry/strategies/spherical/point_in_point.hpp

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,12 @@
55
// Copyright (c) 2009-2015 Mateusz Loskot, London, UK.
66
// Copyright (c) 2013-2015 Adam Wulkiewicz, Lodz, Poland
77

8-
// This file was modified by Oracle on 2013-2020.
9-
// Modifications copyright (c) 2013-2020, Oracle and/or its affiliates.
8+
// This file was modified by Oracle on 2013-2025.
9+
// Modifications copyright (c) 2013-2025, Oracle and/or its affiliates.
1010

11-
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
11+
// Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle
1212
// Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle
13+
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
1314

1415
// Parts of Boost.Geometry are redesigned from Geodan's Geographic Library
1516
// (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands.
@@ -67,13 +68,14 @@ class point_point_on_spheroid
6768
{
6869
static inline bool apply(Point1 const& point1, Point2 const& point2)
6970
{
70-
typedef typename helper_geometry<Point1>::type helper_point_type1;
71-
typedef typename helper_geometry<Point2>::type helper_point_type2;
71+
using helper_point_type1 = typename helper_geometry<Point1>::type;
72+
using helper_point_type2 = typename helper_geometry<Point2>::type;
7273

7374
helper_point_type1 point1_normalized;
74-
strategy::normalize::spherical_point::apply(point1, point1_normalized);
75+
bool const exact_normalized = false;
76+
strategy::normalize::spherical_point::apply(point1, point1_normalized, exact_normalized);
7577
helper_point_type2 point2_normalized;
76-
strategy::normalize::spherical_point::apply(point2, point2_normalized);
78+
strategy::normalize::spherical_point::apply(point2, point2_normalized, exact_normalized);
7779

7880
return point_point_generic
7981
<
@@ -87,11 +89,11 @@ class point_point_on_spheroid
8789
{
8890
static inline bool apply(Point1 const& point1, Point2 const& point2)
8991
{
90-
typedef typename geometry::select_most_precise
92+
using calculation_type = typename geometry::select_most_precise
9193
<
9294
typename fp_coordinate_type<Point1>::type,
9395
typename fp_coordinate_type<Point2>::type
94-
>::type calculation_type;
96+
>::type;
9597

9698
typename helper_geometry
9799
<
@@ -149,7 +151,7 @@ namespace services
149151
template <typename PointLike1, typename PointLike2, typename Tag1, typename Tag2>
150152
struct default_strategy<PointLike1, PointLike2, Tag1, Tag2, pointlike_tag, pointlike_tag, spherical_tag, spherical_tag>
151153
{
152-
typedef strategy::within::spherical_point_point type;
154+
using type = strategy::within::spherical_point_point;
153155
};
154156

155157
} // namespace services
@@ -166,7 +168,7 @@ namespace strategy { namespace covered_by { namespace services
166168
template <typename PointLike1, typename PointLike2, typename Tag1, typename Tag2>
167169
struct default_strategy<PointLike1, PointLike2, Tag1, Tag2, pointlike_tag, pointlike_tag, spherical_tag, spherical_tag>
168170
{
169-
typedef strategy::within::spherical_point_point type;
171+
using type = strategy::within::spherical_point_point;
170172
};
171173

172174
}}} // namespace strategy::covered_by::services

include/boost/geometry/strategy/cartesian/side_by_triangle.hpp

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
#include <boost/geometry/strategies/compare.hpp>
3434
#include <boost/geometry/strategies/side.hpp>
3535

36+
#include <boost/geometry/util/promote_integral.hpp>
3637
#include <boost/geometry/util/select_calculation_type.hpp>
3738
#include <boost/geometry/util/select_most_precise.hpp>
3839

@@ -205,23 +206,29 @@ public :
205206
template <typename P1, typename P2, typename P>
206207
static inline int apply(P1 const& p1, P2 const& p2, P const& p)
207208
{
208-
using coor_t = typename select_calculation_type_alt<CalculationType, P1, P2, P>::type;
209-
210-
// Promote float->double, small int->int
211-
using promoted_t = typename select_most_precise<coor_t, double>::type;
212-
213-
bool const are_all_integral_coordinates =
209+
constexpr bool are_all_integral_coordinates =
214210
std::is_integral<coordinate_type_t<P1>>::value
215211
&& std::is_integral<coordinate_type_t<P2>>::value
216212
&& std::is_integral<coordinate_type_t<P>>::value;
217213

214+
// Promote float to double
215+
// For integer: short -> int -> long
216+
// For larger integers: long, long long, std::int64_t all stay as they are (on a Mac)
217+
using coor_t = typename select_calculation_type_alt<CalculationType, P1, P2, P>::type;
218+
using promoted_t = std::conditional_t
219+
<
220+
are_all_integral_coordinates,
221+
typename promote_integral<coor_t>::type,
222+
typename select_most_precise<coor_t, double>::type
223+
>;
224+
218225
eps_policy< math::detail::equals_factor_policy<promoted_t> > epsp;
219-
promoted_t s = compute_side_value
226+
promoted_t const s = compute_side_value
220227
<
221228
coor_t, promoted_t, are_all_integral_coordinates
222229
>::apply(p1, p2, p, epsp);
223230

224-
promoted_t const zero = promoted_t();
231+
static promoted_t const zero = promoted_t();
225232
return math::detail::equals_by_policy(s, zero, epsp.policy) ? 0
226233
: s > zero ? 1
227234
: -1;

include/boost/geometry/util/normalize_spheroidal_coordinates.hpp

Lines changed: 30 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,9 @@
22

33
// Copyright (c) 2017 Adam Wulkiewicz, Lodz, Poland.
44

5-
// Copyright (c) 2015-2022, Oracle and/or its affiliates.
5+
// Copyright (c) 2015-2025, Oracle and/or its affiliates.
66

7+
// Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle
78
// Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle
89
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
910
// Contributed and/or modified by Adeel Ahmad, as part of Google Summer of Code 2018 program
@@ -151,11 +152,7 @@ struct constants_on_spheroid<CoordinateType, degree, false>
151152
template <typename Units, typename CoordinateType>
152153
inline CoordinateType latitude_convert_ep(CoordinateType const& lat)
153154
{
154-
typedef math::detail::constants_on_spheroid
155-
<
156-
CoordinateType,
157-
Units
158-
> constants;
155+
using constants = math::detail::constants_on_spheroid<CoordinateType, Units>;
159156

160157
return constants::quarter_period() - lat;
161158
}
@@ -164,31 +161,21 @@ inline CoordinateType latitude_convert_ep(CoordinateType const& lat)
164161
template <typename Units, bool IsEquatorial, typename T>
165162
static bool is_latitude_pole(T const& lat)
166163
{
167-
typedef math::detail::constants_on_spheroid
168-
<
169-
T,
170-
Units
171-
> constants;
164+
using constants = math::detail::constants_on_spheroid<T, Units>;
172165

173166
return math::equals(math::abs(IsEquatorial
174167
? lat
175168
: math::latitude_convert_ep<Units>(lat)),
176169
constants::quarter_period());
177-
178170
}
179171

180172

181173
template <typename Units, typename T>
182174
static bool is_longitude_antimeridian(T const& lon)
183175
{
184-
typedef math::detail::constants_on_spheroid
185-
<
186-
T,
187-
Units
188-
> constants;
176+
using constants = math::detail::constants_on_spheroid<T, Units>;
189177

190178
return math::equals(math::abs(lon), constants::half_period());
191-
192179
}
193180

194181

@@ -218,7 +205,7 @@ struct latitude_convert_if_polar<Units, false>
218205
template <typename Units, typename CoordinateType, bool IsEquatorial = true>
219206
class normalize_spheroidal_coordinates
220207
{
221-
typedef constants_on_spheroid<CoordinateType, Units> constants;
208+
using constants = constants_on_spheroid<CoordinateType, Units>;
222209

223210
protected:
224211
static inline CoordinateType normalize_up(CoordinateType const& value)
@@ -236,17 +223,22 @@ class normalize_spheroidal_coordinates
236223
}
237224

238225
public:
239-
static inline void apply(CoordinateType& longitude)
226+
static inline void apply(CoordinateType& longitude, bool exact = true)
240227
{
241228
// normalize longitude
242-
if (math::equals(math::abs(longitude), constants::half_period()))
229+
CoordinateType const epsilon = std::numeric_limits<float>::epsilon();
230+
static constexpr bool is_integer = std::numeric_limits<CoordinateType>::is_integer;
231+
232+
if (exact || is_integer ? math::equals(math::abs(longitude), constants::half_period())
233+
: math::abs(math::abs(longitude) - constants::half_period()) <= epsilon)
243234
{
244235
longitude = constants::half_period();
245236
}
246237
else if (longitude > constants::half_period())
247238
{
248239
longitude = normalize_up(longitude);
249-
if (math::equals(longitude, -constants::half_period()))
240+
if (exact || is_integer ? math::equals(longitude, -constants::half_period())
241+
: math::abs(longitude + constants::half_period()) <= epsilon)
250242
{
251243
longitude = constants::half_period();
252244
}
@@ -259,7 +251,8 @@ class normalize_spheroidal_coordinates
259251

260252
static inline void apply(CoordinateType& longitude,
261253
CoordinateType& latitude,
262-
bool normalize_poles = true)
254+
bool normalize_poles = true,
255+
bool exact = true)
263256
{
264257
latitude_convert_if_polar<Units, IsEquatorial>::apply(latitude);
265258

@@ -288,7 +281,7 @@ class normalize_spheroidal_coordinates
288281
#endif // BOOST_GEOMETRY_NORMALIZE_LATITUDE
289282

290283
// normalize longitude
291-
apply(longitude);
284+
apply(longitude, exact);
292285

293286
// finally normalize poles
294287
if (normalize_poles)
@@ -317,7 +310,7 @@ class normalize_spheroidal_coordinates
317310
template <typename Units, typename CoordinateType>
318311
inline void normalize_angle_loop(CoordinateType& angle)
319312
{
320-
typedef constants_on_spheroid<CoordinateType, Units> constants;
313+
using constants = constants_on_spheroid<CoordinateType, Units>;
321314
CoordinateType const pi = constants::half_period();
322315
CoordinateType const two_pi = constants::period();
323316
while (angle > pi)
@@ -329,7 +322,7 @@ inline void normalize_angle_loop(CoordinateType& angle)
329322
template <typename Units, typename CoordinateType>
330323
inline void normalize_angle_cond(CoordinateType& angle)
331324
{
332-
typedef constants_on_spheroid<CoordinateType, Units> constants;
325+
using constants = constants_on_spheroid<CoordinateType, Units>;
333326
CoordinateType const pi = constants::half_period();
334327
CoordinateType const two_pi = constants::period();
335328
if (angle > pi)
@@ -353,22 +346,24 @@ inline void normalize_angle_cond(CoordinateType& angle)
353346
*/
354347
template <typename Units, typename CoordinateType>
355348
inline void normalize_spheroidal_coordinates(CoordinateType& longitude,
356-
CoordinateType& latitude)
349+
CoordinateType& latitude,
350+
bool exact = true)
357351
{
358352
detail::normalize_spheroidal_coordinates
359353
<
360354
Units, CoordinateType
361-
>::apply(longitude, latitude);
355+
>::apply(longitude, latitude, true, exact);
362356
}
363357

364358
template <typename Units, bool IsEquatorial, typename CoordinateType>
365359
inline void normalize_spheroidal_coordinates(CoordinateType& longitude,
366-
CoordinateType& latitude)
360+
CoordinateType& latitude,
361+
bool exact = true)
367362
{
368363
detail::normalize_spheroidal_coordinates
369364
<
370365
Units, CoordinateType, IsEquatorial
371-
>::apply(longitude, latitude);
366+
>::apply(longitude, latitude, true, exact);
372367
}
373368

374369
/*!
@@ -381,12 +376,12 @@ inline void normalize_spheroidal_coordinates(CoordinateType& longitude,
381376
\ingroup utility
382377
*/
383378
template <typename Units, typename CoordinateType>
384-
inline void normalize_longitude(CoordinateType& longitude)
379+
inline void normalize_longitude(CoordinateType& longitude, bool exact = true)
385380
{
386381
detail::normalize_spheroidal_coordinates
387382
<
388383
Units, CoordinateType
389-
>::apply(longitude);
384+
>::apply(longitude, exact);
390385
}
391386

392387
/*!
@@ -400,7 +395,7 @@ inline void normalize_longitude(CoordinateType& longitude)
400395
template <typename Units, typename CoordinateType>
401396
inline void normalize_azimuth(CoordinateType& angle)
402397
{
403-
normalize_longitude<Units, CoordinateType>(angle);
398+
math::normalize_longitude<Units, CoordinateType>(angle, true);
404399
}
405400

406401
/*!
@@ -435,7 +430,7 @@ inline CoordinateType longitude_distance_signed(CoordinateType const& longitude1
435430
CoordinateType const& longitude2)
436431
{
437432
CoordinateType diff = longitude2 - longitude1;
438-
math::normalize_longitude<Units, CoordinateType>(diff);
433+
math::normalize_longitude<Units, CoordinateType>(diff, true);
439434
return diff;
440435
}
441436

@@ -453,10 +448,7 @@ template <typename Units, typename CoordinateType>
453448
inline CoordinateType longitude_distance_unsigned(CoordinateType const& longitude1,
454449
CoordinateType const& longitude2)
455450
{
456-
typedef math::detail::constants_on_spheroid
457-
<
458-
CoordinateType, Units
459-
> constants;
451+
using constants = math::detail::constants_on_spheroid<CoordinateType, Units>;
460452

461453
CoordinateType const c0 = 0;
462454
CoordinateType diff = longitude_distance_signed<Units>(longitude1, longitude2);

0 commit comments

Comments
 (0)