@@ -223,7 +223,8 @@ class normalize_spheroidal_coordinates
223223 }
224224
225225public:
226- static inline void apply (CoordinateType& longitude, bool exact = true )
226+ static inline void apply (CoordinateType& longitude, bool exact = true ,
227+ bool allow_antimeridian_crossing = false )
227228 {
228229 // normalize longitude
229230 CoordinateType const epsilon = std::numeric_limits<float >::epsilon ();
@@ -234,7 +235,7 @@ class normalize_spheroidal_coordinates
234235 {
235236 longitude = constants::half_period ();
236237 }
237- else if (longitude > constants::half_period ())
238+ else if ( ! allow_antimeridian_crossing && longitude > constants::half_period ())
238239 {
239240 longitude = normalize_up (longitude);
240241 if (exact || is_integer ? math::equals (longitude, -constants::half_period ())
@@ -252,7 +253,8 @@ class normalize_spheroidal_coordinates
252253 static inline void apply (CoordinateType& longitude,
253254 CoordinateType& latitude,
254255 bool normalize_poles = true ,
255- bool exact = true )
256+ bool exact = true ,
257+ bool allow_antimeridian_crossing = false )
256258 {
257259 latitude_convert_if_polar<Units, IsEquatorial>::apply (latitude);
258260
@@ -281,7 +283,7 @@ class normalize_spheroidal_coordinates
281283#endif // BOOST_GEOMETRY_NORMALIZE_LATITUDE
282284
283285 // normalize longitude
284- apply (longitude, exact);
286+ apply (longitude, exact, allow_antimeridian_crossing );
285287
286288 // finally normalize poles
287289 if (normalize_poles)
@@ -302,7 +304,8 @@ class normalize_spheroidal_coordinates
302304#endif // BOOST_GEOMETRY_NORMALIZE_LATITUDE
303305
304306 BOOST_GEOMETRY_ASSERT (! math::larger_or_equals (constants::min_longitude (), longitude));
305- BOOST_GEOMETRY_ASSERT (! math::larger (longitude, constants::max_longitude ()));
307+ BOOST_GEOMETRY_ASSERT (! math::larger (longitude, constants::max_longitude ())
308+ || allow_antimeridan_crossing);
306309 }
307310};
308311
0 commit comments