Skip to content

Commit fe817e6

Browse files
authored
Merge pull request #1365 from awulkiew/fix/warning
[formulas] Fix warning (variable hiding member) in sjoberg_intersection
2 parents 2ee3d89 + 2a5b668 commit fe817e6

File tree

2 files changed

+19
-4
lines changed

2 files changed

+19
-4
lines changed

include/boost/geometry/formulas/sjoberg_intersection.hpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// Boost.Geometry
22

3-
// Copyright (c) 2023 Adam Wulkiewicz, Lodz, Poland.
3+
// Copyright (c) 2023-2025 Adam Wulkiewicz, Lodz, Poland.
44

55
// Copyright (c) 2016-2019 Oracle and/or its affiliates.
66
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
@@ -566,7 +566,6 @@ class sjoberg_geodesic
566566
{
567567
CT const c0 = 0;
568568
CT const dLj = d_lambda(c0);
569-
CT const asin_tj_t0j = asin(Cj * tan_betaj / sqrt_1_Cj_sqr);
570569
return lonj - asin_tj_t0j + dLj;
571570
}
572571

@@ -676,8 +675,8 @@ class sjoberg_intersection
676675
CT const f = formula::flattening<CT>(spheroid);
677676
CT const one_minus_f = c1 - f;
678677

679-
geodesic_type geod1(lon_a1, lat_a1, alpha_a1, f);
680-
geodesic_type geod2(lon_b1, lat_b1, alpha_b1, f);
678+
geodesic_type const geod1(lon_a1, lat_a1, alpha_a1, f);
679+
geodesic_type const geod2(lon_b1, lat_b1, alpha_b1, f);
681680

682681
// Cj = 1 if on equator <=> sqrt_1_Cj_sqr = 0
683682
// Cj = 0 if vertical <=> sqrt_1_Cj_sqr = 1

test/formulas/intersection.cpp

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
// Boost.Geometry
22
// Unit Test
33

4+
// Copyright (c) 2025 Adam Wulkiewicz, Lodz, Poland.
5+
46
// Copyright (c) 2016-2019 Oracle and/or its affiliates.
57

68
// Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle
@@ -185,6 +187,19 @@ void test_bugs()
185187
}
186188
}
187189

190+
void test_special_cases()
191+
{
192+
{
193+
double lon, lat;
194+
bg::formula::sjoberg_intersection<double, bg::formula::andoyer_inverse, 1>
195+
::apply(-0.01, 0.0, 0.01, 0.0,
196+
0.0, -0.01, 0.0, 0.01,
197+
lon, lat, bg::srs::spheroid<double>());
198+
check_one("geodesic on equator", lon, 0.0);
199+
check_one("geodesic on equator", lat, 0.0);
200+
}
201+
}
202+
188203
int test_main(int, char*[])
189204
{
190205
for (size_t i = 0; i < expected_size; ++i)
@@ -193,6 +208,7 @@ int test_main(int, char*[])
193208
}
194209

195210
test_bugs();
211+
test_special_cases();
196212

197213
return 0;
198214
}

0 commit comments

Comments
 (0)