From 195da3452446b51e7c99be0fe9ae5c6472900409 Mon Sep 17 00:00:00 2001 From: Pierre Louvart Date: Sun, 5 Jan 2025 12:33:48 +0100 Subject: [PATCH] - Remove manual computation with semi-major-axis. Sanitize all matrices from semi-major-axis value. Recompute airocean test values. --- src/projections/airocean.cpp | 58 ++++--- test/gie/builtins.gie | 302 +++++++++++++++++------------------ 2 files changed, 177 insertions(+), 183 deletions(-) diff --git a/src/projections/airocean.cpp b/src/projections/airocean.cpp index b2ccce962a..afb7f8952d 100644 --- a/src/projections/airocean.cpp +++ b/src/projections/airocean.cpp @@ -24,7 +24,6 @@ namespace { // anonymous namespace } - /* The vertices of the faces of the icosahedron are inspired by those used by Robert W. Gray. @@ -37,37 +36,38 @@ namespace { // anonymous namespace */ // Define the 23 faces and subfaces constexpr pj_face base_ico_faces[23] = {{{0.42015243, 0.07814525, 0.90408255}, {0.51883673, 0.83542038, 0.18133184}, {0.99500944, -0.0913478, 0.04014718}}, {{0.42015243, 0.07814525, 0.90408255}, {-0.41468223, 0.65596241, 0.63067581}, {0.51883673, 0.83542038, 0.18133184}}, {{0.42015243, 0.07814525, 0.90408255}, {-0.51545596, -0.3817169, 0.76720099}, {-0.41468223, 0.65596241, 0.63067581}}, {{0.42015243, 0.07814525, 0.90408255}, {0.3557814, -0.84358, 0.40223423}, {-0.51545596, -0.3817169, 0.76720099}}, {{0.42015243, 0.07814525, 0.90408255}, {0.99500944, -0.0913478, 0.04014718}, {0.3557814, -0.84358, 0.40223423}}, {{0.99500944, -0.0913478, 0.04014718}, {0.51883673, 0.83542038, 0.18133184}, {0.51545596, 0.3817169, -0.76720099}}, {{0.51545596, 0.3817169, -0.76720099}, {0.51883673, 0.83542038, 0.18133184}, {-0.3557814, 0.84358, -0.40223423}}, {{-0.3557814, 0.84358, -0.40223423}, {0.51883673, 0.83542038, 0.18133184}, {-0.41468223, 0.65596241, 0.63067581}}, {{-0.51545596, -0.3817169, 0.76720099}, {-0.99500944, 0.0913478, -0.04014718}, {-0.41468223, 0.65596241, 0.63067581}}, {{-0.51545596, -0.3817169, 0.76720099}, {-0.51883673, -0.83542038, -0.18133184}, {-0.99500944, 0.0913478, -0.04014718}}, {{-0.51545596, -0.3817169, 0.76720099}, {0.3557814, -0.84358, 0.40223423}, {-0.51883673, -0.83542038, -0.18133184}}, {{-0.51883673, -0.83542038, -0.18133184}, {0.3557814, -0.84358, 0.40223423}, {0.41468223, -0.65596241, -0.63067581}}, {{0.41468223, -0.65596241, -0.63067581}, {0.3557814, -0.84358, 0.40223423}, {0.99500944, -0.0913478, 0.04014718}}, {{0.51545596, 0.3817169, -0.76720099}, {0.41468223, -0.65596241, -0.63067581}, {0.99500944, -0.0913478, 0.04014718}}, {{-0.42015243, -0.07814525, -0.90408255}, {-0.3557814, 0.84358, -0.40223423}, {-0.99500944, 0.0913478, -0.04014718}}, {{-0.42015243, -0.07814525, -0.90408255}, {-0.99500944, 0.0913478, -0.04014718}, {-0.51883673, -0.83542038, -0.18133184}}, {{-0.42015243, -0.07814525, -0.90408255}, {-0.51883673, -0.83542038, -0.18133184}, {0.41468223, -0.65596241, -0.63067581}}, {{-0.42015243, -0.07814525, -0.90408255}, {0.41468223, -0.65596241, -0.63067581}, {0.51545596, 0.3817169, -0.76720099}}, {{-0.3557814, 0.84358, -0.40223423}, {-0.38796691, 0.38271738, -0.65315839}, {0.51545596, 0.3817169, -0.76720099}}, {{-0.42015243, -0.07814525, -0.90408255}, {0.51545596, 0.3817169, -0.76720099}, {-0.38796691, 0.38271738, -0.65315839}}, {{-0.99500944, 0.0913478, -0.04014718}, {-0.3557814, 0.84358, -0.40223423}, {-0.58849102, 0.53029673, 0.0627648}}, {{-0.3557814, 0.84358, -0.40223423}, {-0.41468223, 0.65596241, 0.63067581}, {-0.58849102, 0.53029673, 0.0627648}}, {{-0.99500944, 0.0913478, -0.04014718}, {-0.58849102, 0.53029673, 0.0627648}, {-0.41468223, 0.65596241, 0.63067581}}}; -// Define the centers for each face or subface +// // Define the centers for each face or subface constexpr PJ_XYZ base_ico_centers[23] = {{0.6446662, 0.27407261, 0.37518718999999995}, {0.1747689766666667, 0.5231760133333333, 0.5720300666666667}, {-0.16999525333333332, 0.11746358666666666, 0.7673197833333334}, {0.08682595666666666, -0.38238388333333334, 0.69117259}, {0.5903144233333334, -0.28559418333333336, 0.44882131999999997}, {0.6764340433333333, 0.37526316, -0.18190732333333334}, {0.22617043, 0.68690576, -0.3293677933333333}, {-0.08387563333333335, 0.77832093, 0.13659113999999997}, {-0.6417158766666667, 0.12186443666666665, 0.45257653999999997}, {-0.6764340433333333, -0.37526316, 0.18190732333333334}, {-0.22617043, -0.68690576, 0.3293677933333333}, {0.08387563333333335, -0.77832093, -0.13659113999999997}, {0.5884910233333334, -0.5302967366666668, -0.06276479999999997}, {0.6417158766666667, -0.12186443666666665, -0.45257653999999997}, {-0.5903144233333334, 0.28559418333333336, -0.44882131999999997}, {-0.6446662, -0.27407261, -0.37518718999999995}, {-0.1747689766666667, -0.5231760133333333, -0.5720300666666667}, {0.16999525333333332, -0.11746358666666668, -0.7673197833333334}, {-0.07609744999999997, 0.5360047600000001, -0.6075312033333334}, {-0.09755446, 0.22876301, -0.7748139766666666}, {-0.6464272866666667, 0.48840817666666664, -0.12653887}, {-0.45298488333333337, 0.6766130466666667, 0.0970687933333333}, {-0.6660608966666667, 0.42586898, 0.21776447666666665}}; -// Define the normals for each face and subface +// // Define the normals for each face and subface constexpr PJ_XYZ base_ico_normals[23] = {{0.8112534716456183, 0.3448953244235397, 0.4721387719026189}, {0.21993078167242514, 0.6583691769191125, 0.7198475381327677}, {-0.21392348218574597, 0.1478171768398566, 0.9656017947376752}, {0.10926252593733311, -0.48119515565604315, 0.8697775132750616}, {0.7428567271237952, -0.3593941714860216, 0.5648005953155497}, {0.8512303999921011, 0.4722343774266651, -0.22891373682183738}, {0.28461480749719364, 0.8644080979012073, -0.4144792535654255}, {-0.1055498134715015, 0.9794457311974099, 0.17188745304792394}, {-0.80754076069938, 0.15335524153301364, 0.5695261975567215}, {-0.8512303999921011, -0.4722343774266651, 0.22891373682183735}, {-0.28461480749719364, -0.8644080979012073, 0.4144792535654255}, {0.10554981347150154, -0.97944573119741, -0.17188745304792397}, {0.7405621455042509, -0.6673299596621295, -0.07898375518726185}, {0.80754076069938, -0.15335524153301364, -0.5695261975567215}, {-0.7428567271237952, 0.3593941714860216, -0.5648005953155497}, {-0.8112534716456183, -0.3448953244235397, -0.4721387719026189}, {-0.21993078167242514, -0.6583691769191125, -0.7198475381327677}, {0.21392348218574597, -0.1478171768398566, -0.9656017947376752}, {-0.1092625236946045, 0.48119515875463253, -0.8697775118425345}, {-0.10926252412771359, 0.4811951525529661, -0.8697775152191327}, {-0.7405621389792739, 0.6673299643797594, 0.07898377650727696}, {-0.7405621607654073, 0.6673299431834946, 0.07898375132383098}, {-0.7405621367680706, 0.6673299714231342, 0.07898373773067752}}; -/* - The points of the Airocean projection map are deduced from the unfolded net - of the altered icosahedron defined above. - The distances in the projected 2d space are expressed in meter. -*/ -// Define the 23 unfolded surfaces used (from icosahedron + split faces) -constexpr pj_face base_airocean_faces[23] = {{{11602775.971724393, 20096597.491866, 1.0}, {11602775.971724393, 26795463.322488002, 1.0}, {17404163.95758659, 23446030.407177, 1.0}}, {{11602775.971724393, 20096597.491866, 1.0}, {5801387.985862196, 23446030.407177, 1.0}, {11602775.971724393, 26795463.322488002, 1.0}}, {{11602775.971724393, 20096597.491866, 1.0}, {5801387.985862196, 16747164.576555002, 1.0}, {5801387.985862196, 23446030.407177, 1.0}}, {{11602775.971724393, 20096597.491866, 1.0}, {11602775.971724393, 13397731.661244001, 1.0}, {5801387.985862196, 16747164.576555002, 1.0}}, {{11602775.971724393, 20096597.491866, 1.0}, {17404163.95758659, 23446030.407177, 1.0}, {17404163.95758659, 16747164.576555002, 1.0}}, {{17404163.95758659, 23446030.407177, 1.0}, {11602775.971724393, 26795463.322488002, 1.0}, {17404163.95758659, 30144896.237799004, 1.0}}, {{11602775.971724393, 33494329.153110005, 1.0}, {11602775.971724393, 26795463.322488002, 1.0}, {5801387.985862196, 30144896.237799004, 1.0}}, {{5801387.985862196, 30144896.237799004, 1.0}, {11602775.971724393, 26795463.322488002, 1.0}, {5801387.985862196, 23446030.407177, 1.0}}, {{5801387.985862196, 16747164.576555002, 1.0}, {0.0, 20096597.491866, 1.0}, {5801387.985862196, 23446030.407177, 1.0}}, {{5801387.985862196, 16747164.576555002, 1.0}, {5801387.985862196, 10048298.745933, 1.0}, {0.0, 13397731.661244001, 1.0}}, {{5801387.985862196, 16747164.576555002, 1.0}, {11602775.971724393, 13397731.661244001, 1.0}, {5801387.985862196, 10048298.745933, 1.0}}, {{5801387.985862196, 10048298.745933, 1.0}, {11602775.971724393, 13397731.661244001, 1.0}, {11602775.971724393, 6698865.830622001, 1.0}}, {{11602775.971724393, 6698865.830622001, 1.0}, {11602775.971724393, 13397731.661244001, 1.0}, {17404163.95758659, 10048298.745933, 1.0}}, {{11602775.971724393, 0.0, 1.0}, {11602775.971724393, 6698865.830622001, 1.0}, {17404163.95758659, 3349432.9153110003, 1.0}}, {{0.0, 33494329.153110005, 1.0}, {5801387.985862196, 30144896.237799004, 1.0}, {0.0, 26795463.322488002, 1.0}}, {{0.0, 6698865.830622001, 1.0}, {0.0, 13397731.661244001, 1.0}, {5801387.985862196, 10048298.745933, 1.0}}, {{5801387.985862196, 3349432.9153110003, 1.0}, {5801387.985862196, 10048298.745933, 1.0}, {11602775.971724393, 6698865.830622001, 1.0}}, {{5801387.985862196, 3349432.9153110003, 1.0}, {11602775.971724393, 6698865.830622001, 1.0}, {11602775.971724393, 0.0, 1.0}}, {{5801387.985862196, 30144896.237799004, 1.0}, {2900693.992931098, 31819612.695454504, 1.0}, {5801387.985862196, 36843762.068421006, 1.0}}, {{5801387.985862196, 3349432.9153110003, 1.0}, {11602775.971724393, 0.0, 1.0}, {5801387.985862196, 0.0, 1.0}}, {{0.0, 26795463.322488002, 1.0}, {5801387.985862196, 30144896.237799004, 1.0}, {3867591.9905747976, 26795463.322488002, 1.0}}, {{5801387.985862196, 30144896.237799004, 1.0}, {5801387.985862196, 23446030.407177, 1.0}, {3867591.9905747976, 26795463.322488002, 1.0}}, {{0.0, 20096597.491866, 1.0}, {1933795.9952873988, 23446030.407177, 1.0}, {5801387.985862196, 23446030.407177, 1.0}}}; - -/* - The parameters here are extracted from the transition matrices - that allow converting a icosahedron face or subface to its - corresponding face in the Airocean projected space. - Since only a few parameters of those matrices are relevant, - the irrelevant ones has been discarded. -*/ -// Icosahedron to Airocean (forward) -constexpr double base_ico_air_trans[23][4][4] = {{{3676785.549175448, -3835017.5266620647, -3516181.101897219, 13536571.968889877}, {597946.080039791, 4588467.120428165, -4379277.476119764, 23446030.430853583}, {0.8112534716456183, 0.3448953244235397, 0.4721387719026189, -0.7946544736643394}, {0.0, 0.0, 0.0, 0.9999999999999999}}, {{6186178.005526091, -1393567.8850913076, -615475.9158875226, 9668979.99656166}, {597946.0790283178, 4588467.148836121, -4379277.446492919, 23446030.4022735}, {0.2199307816724251, 0.6583691769191125, 0.7198475381327677, -0.794654474160402}, {2.7755575615628914e-17, 0.0, 0.0, 1.0}}, {{6193487.416382644, -412638.42193403625, 1435299.1565727487, 7735183.994711302}, {610606.2949588482, 6287486.763792622, -827230.771869741, 20096597.453907937}, {-0.213923482185746, 0.14781717683985665, 0.9656017947376753, -0.7946544722350559}, {-1.3877787807814457e-16, 2.7755575615628914e-17, 0.0, 1.0}}, {{6320833.951539666, -6999.925417495968, -797903.6054442794, 9668979.964544488}, {390035.65785509185, 5584900.2162612835, 3040789.86561249, 16747164.583089648}, {0.1092625259373331, -0.48119515565604315, 0.8697775132750618, -0.794654472177355}, {1.1102230246251565e-16, 5.551115123125783e-17, 0.0, 1.0}}, {{1785817.7160921493, -3817376.067203325, -4777879.901545344, 15470367.97086971}, {3873198.4648612146, 4557911.12782605, -2193951.0189847522, 20096597.472239383}, {0.7428567271237952, -0.3593941714860217, 0.5648005953155497, -0.7946544741179917}, {0.0, 0.0, 0.0, 1.0000000000000002}}, {{1653953.7567438218, -4829262.323420258, -3812125.829251187, 15470367.969285296}, {-2905701.3326818133, 2866384.6227320307, -4891868.725058803, 26795463.326497696}, {0.8512303999921013, 0.4722343774266651, -0.22891373682183747, -0.7946544711481622}, {0.0, -5.551115123125783e-17, 1.1102230246251565e-16, 1.0}}, {{6107473.604777472, -1644266.325782215, 764719.3302896866, 9668979.973521523}, {-20484.65208776388, -2749071.5526177026, -5747332.168284684, 30144896.23069373}, {0.2846148074971938, 0.8644080979012073, -0.41447925356542553, -0.7946544719642821}, {0.0, -1.1102230246251565e-16, 0.0, 1.0}}, {{6325351.398413758, 599247.844237452, 469545.1345954169, 7735183.991104206}, {356890.77665911405, 1136808.9376555325, -6258588.903331836, 26795463.365920186}, {-0.10554981347150151, 0.97944573119741, 0.17188745304792394, -0.794654473006748}, {-1.3877787807814457e-17, 0.0, 8.326672684688674e-17, 1.0}}, {{3707748.6155441254, 320266.3046413801, 5171041.531732354, 3867591.9864321505}, {610606.2818745336, 6287486.766371998, -827230.7619227654, 20096597.44051682}, {-0.8075407606993799, 0.15335524153301364, 0.5695261975567214, -0.7946544732451482}, {0.0, -8.326672684688674e-17, 0.0, 1.0}}, {{3343388.0482846545, -4896993.062013145, 2330419.6732539237, 3867591.9905542377}, {20484.69631605078, 2749071.5422549895, 5747332.173083752, 13397731.669298988}, {-0.8512303999921013, -0.4722343774266651, 0.22891373682183733, -0.7946544711481622}, {1.1102230246251565e-16, 0.0, -2.7755575615628914e-17, 1.0}}, {{6107473.604777474, -1644266.3257822143, 764719.330289686, 7735183.984065069}, {20484.65208776346, 2749071.552617706, 5747332.168284684, 13397731.654138729}, {-0.28461480749719376, -0.8644080979012073, 0.41447925356542553, -0.7946544719642822}, {-5.551115123125783e-17, 0.0, -5.551115123125783e-17, 1.0}}, {{6325351.398413757, 599247.8442374519, 469545.1345954159, 9668979.966482382}, {-356890.77665911167, -1136808.9376555379, 6258588.903331836, 10048298.789365184}, {0.10554981347150151, -0.97944573119741, -0.17188745304792394, -0.794654473006748}, {1.249000902703301e-16, 0.0, -8.326672684688674e-17, 1.0}}, {{4266333.348411551, 4606685.482609389, 1080041.5914374113, 13536571.961679665}, {-356890.81480763154, -1136808.9649443403, 6258588.896199714, 10048298.78278621}, {0.7405621455042507, -0.6673299596621294, -0.07898375518726183, -0.7946544743360283}, {1.1102230246251565e-16, 0.0, 5.551115123125783e-17, 0.9999999999999999}}, {{3707748.6155441264, 320266.30464138015, 5171041.531732352, 13536571.97115444}, {-610606.2818745337, -6287486.766372, 827230.7619227694, 3349432.8639618154}, {0.8075407606993799, -0.15335524153301364, -0.5695261975567214, -0.7946544732451483}, {-1.1102230246251565e-16, -2.7755575615628914e-17, 0.0, 1.0}}, {{2461379.4064226267, 5855954.858490806, 488922.63367311924, 1933796.0165698116}, {3483162.7410947136, -1026989.0860837825, -5234740.880461738, 30144896.24019003}, {-0.7428567271237954, 0.35939417148602165, -0.5648005953155498, -0.7946544741179918}, {-1.1102230246251565e-16, 5.551115123125783e-17, 0.0, 1.0}}, {{1320556.279179943, -5891237.854051452, 2034474.9935921053, 1933796.0148528814}, {-3483162.72987335, 1026989.0418338334, 5234740.896609632, 10048298.759397767}, {-0.8112534716456183, -0.34489532442353976, -0.4721387719026189, -0.7946544736643393}, {0.0, 1.1102230246251565e-16, 0.0, 1.0}}, {{6186178.005526091, -1393567.885091309, -615475.9158875229, 7735183.961024929}, {-597946.0790283154, -4588467.148836119, 4379277.446492919, 6698865.825718503}, {-0.21993078167242508, -0.6583691769191125, -0.7198475381327677, -0.794654474160402}, {0.0, -1.1102230246251565e-16, 0.0, 1.0}}, {{6193487.416382645, -412638.4219340361, 1435299.156572748, 9668979.962875288}, {-610606.2949588535, -6287486.763792623, 827230.7718697439, 3349432.877352944}, {0.21392348218574594, -0.14781717683985665, -0.965601794737675, -0.7946544722350558}, {-1.3877787807814457e-16, -2.7755575615628914e-17, 0.0, 1.0}}, {{3498197.81693495, 4833165.559061878, 2234449.5231911456, 3867591.983769496}, {5278984.96116607, -2798512.200701845, -2211399.7153384583, 33494329.158408284}, {-0.10926252369460446, 0.4811951587546325, -0.8697775118425342, -0.7946544734171301}, {8.326672684688674e-17, 0.0, 0.0, 0.9999999999999998}}, {{6320833.983680945, -6999.984355479206, -797903.6271294819, 7735183.9823354}, {-390035.68446349393, -5584900.177255948, -3040789.814780467, 0.044359486997177525}, {-0.10926252412771358, 0.48119515255296597, -0.8697775152191325, -0.79465447341713}, {-4.163336342344337e-17, -1.1102230246251565e-16, 0.0, 0.9999999999999999}}, {{4266333.41772867, 4606685.445409489, 1080041.6365273518, 3867592.0700864717}, {356890.72771489987, 1136809.053212709, -6258588.866576485, 26795463.265809294}, {-0.7405621389792741, 0.6673299643797597, 0.07898377650727716, -0.7946544674186218}, {1.1102230246251565e-16, 0.0, -1.3877787807814457e-17, 1.0}}, {{4266333.204506115, 4606685.540218764, 1080041.5936954806, 3867591.897018196}, {356890.8007120557, 1136808.9497242568, -6258588.899768077, 26795463.365730304}, {-0.7405621607654075, 0.6673299431834948, 0.07898375132383098, -0.7946544674186217}, {1.1102230246251565e-16, -1.1102230246251565e-16, 2.7755575615628914e-17, 0.9999999999999999}}, {{1824090.1118675405, 1318837.3514699321, 5960117.7705610385, 1933795.9110601672}, {3873198.583330483, 4557911.083457602, -2193951.0468033054, 23446030.547617782}, {-0.7405621367680707, 0.667329971423134, 0.07898373773067754, -0.7946544674186213}, {0.0, 0.0, 8.326672684688674e-17, 1.0}}}; -// Airocean to Icosahedron (inverse) -constexpr double base_air_ico_trans[23][4][4] = {{{9.058433279771384e-08, 1.4731493732699052e-08, 0.8112534716456185, -0.9269301899999991}, {-9.44826679987233e-08, 1.1304527499839262e-07, 0.34489532442353965, -1.0974189099999994}, {-8.662754779110161e-08, -1.0789150406568015e-07, 0.47213877190261877, 4.077454709999999}, {0.0, 2.646977960169691e-23, 0.0, 1.0}}, {{1.5240780519329358e-07, 1.473149373269901e-08, 0.219930781672425, -1.6442540899999978}, {-3.4333093302050216e-08, 1.1304527499839258e-07, 0.6583691769191122, -1.7953209499999985}, {-1.51633738709386e-08, -1.0789150406568015e-07, 0.719847538132768, 3.248271909999998}, {-1.3234889800848443e-23, 2.6469779601696886e-23, 0.0, 1.0}}, {{1.525878853745444e-07, 1.504340175606161e-08, -0.21392348218574625, -1.6526118100000007}, {-1.0166102516109274e-08, 1.5490373090569122e-07, 0.14781717683985585, -2.9169376700000003}, {3.536121881520939e-08, -2.0380342501548998e-08, 0.9656017947376755, 0.9033697899999995}, {-1.3234889800848443e-23, 2.6469779601696886e-23, 2.220446049250313e-16, 1.0}}, {{1.557252983599121e-07, 9.609243061078464e-09, 0.10926252593733309, -1.5798064100000002}, {-1.7245441994882394e-10, 1.375942246501773e-07, -0.48119515565604315, -2.6850295500000003}, {-1.96578129712955e-08, 7.491541593592458e-08, 0.8697775132750615, -0.37337721000000035}, {2.6469779601696886e-23, 1.3234889800848443e-23, 0.0, 1.0}}, {{4.399688326690425e-08, 9.54233233151121e-08, 0.7428567271237949, -2.0080176699999996}, {-9.404803666461074e-08, 1.122924714451482e-07, -0.35939417148602176, -1.0873330499999996}, {-1.1771180391040664e-07, -5.405199315156007e-08, 0.5648005953155502, 3.3561273899999997}, {0.0, 0.0, 0.0, 1.0}}, {{4.074817450170371e-08, -7.158726449003567e-08, 0.8512303999921009, 1.9642587099999982}, {-1.1897770528054373e-07, 7.061862589298568e-08, 0.4722343774266655, 0.3236332400000001}, {-9.391868744648748e-08, -1.2052012839388902e-07, -0.22891373682183766, 4.500442009999996}, {1.3234889800848443e-23, 2.6469779601696886e-23, 0.0, 0.9999999999999991}}, {{1.5046877525297362e-07, -5.046779687011883e-10, 0.2846148074971936, -1.2134956799999999}, {-4.0509505754953036e-08, -6.772840231043597e-08, 0.8644080979012075, 3.120257019999999}, {1.8840259480379495e-08, -1.4159603341569342e-07, -0.4144792535654251, 3.7568638499999985}, {0.0, -1.1754943508222875e-38, 0.0, 1.0}}, {{1.55836594139745e-07, 8.792657069014762e-09, -0.1055498134715016, -1.52490368}, {1.4763566099823772e-08, 2.800736643244269e-08, 0.97944573119741, -0.08634832999999958}, {1.1568102351290336e-08, -1.5419177904390005e-07, 0.17188745304792347, 4.178749899999998}, {1.3234889800848443e-23, 0.0, 0.0, 1.0}}, {{9.134716490113195e-08, 1.504340175606163e-08, -0.80754076069938, -1.2973306300000003}, {7.890345398644546e-09, 1.5490373090569127e-07, 0.15335524153301333, -3.021690130000001}, {1.2739806091251417e-07, -2.0380342501549028e-08, 0.5695261975567216, 0.3694283599999999}, {1.3234889800848443e-23, -2.6469779601696886e-23, 0.0, 1.0}}, {{8.237047688665845e-08, 5.04677968701152e-10, -0.8512303999921011, -1.0017709799999996}, {-1.2064637664394705e-07, 6.772840231043599e-08, -0.472234377426665, -0.8160591599999997}, {5.741414913322641e-08, 1.4159603341569342e-07, 0.2289137368218376, -1.937212839999999}, {-2.6469779601696886e-23, 1.323488980084844e-23, 0.0, 1.0}}, {{1.504687752529736e-07, 5.046779687011514e-10, -0.2846148074971936, -1.3968356299999996}, {-4.0509505754953036e-08, 6.772840231043597e-08, -0.8644080979012072, -1.2809642399999992}, {1.8840259480379524e-08, 1.415960334156934e-07, 0.41447925356542575, -1.713430739999999}, {1.3234889800848443e-23, 0.0, 0.0, 0.9999999999999998}}, {{1.55836594139745e-07, -8.792657069014724e-09, 0.10554981347150141, -1.3345540299999996}, {1.4763566099823759e-08, -2.8007366432442684e-08, -0.97944573119741, -0.6396431699999997}, {1.1568102351290311e-08, 1.5419177904390013e-07, -0.17188745304792416, -1.7978079499999997}, {0.0, -2.6469779601696886e-23, 0.0, 0.9999999999999998}}, {{1.0510891988020954e-07, -8.792657069014762e-09, 0.740562145504251, -0.7459721899999996}, {1.1349411668458604e-07, -2.8007366432442694e-08, -0.6673299596621296, -1.7851916299999993}, {2.6608799545245027e-08, 1.541917790439001e-07, -0.07898375518726153, -1.9723217899999996}, {0.0, 0.0, 0.0, 1.0}}, {{9.134716490113195e-08, -1.5043401756061595e-08, 0.80754076069938, -0.5444247299999998}, {7.890345398644617e-09, -1.5490373090569122e-07, -0.15335524153301372, 0.29016699000000007}, {1.2739806091251412e-07, 2.038034250154901e-08, -0.5695261975567216, -2.2453721499999992}, {0.0, 0.0, 0.0, 1.0}}, {{6.064058047097081e-08, 8.58140802540336e-08, -0.7428567271237954, -3.294437479999999}, {1.4427215125754238e-07, -2.530175320502907e-08, 0.3593941714860216, 0.7693199999999997}, {1.2045502760769865e-08, -1.2896740908748457e-07, -0.5648005953155495, 3.4155942999999986}, {1.3234889800848443e-23, 0.0, 0.0, 1.0}}, {{3.2534318590648264e-08, -8.581408025403363e-08, -0.8112534716456185, 0.15470457999999998}, {-1.4514141392576755e-07, 2.530175320502908e-08, -0.34489532442353965, -0.2476383}, {5.01230094778404e-08, 1.289674090874846e-07, -0.47213877190261855, -1.7680179200000001}, {0.0, 0.0, 0.0, 1.0}}, {{1.524078051932937e-07, -1.4731493732699067e-08, -0.21993078167242536, -1.25498709}, {-3.433309330205022e-08, -1.1304527499839266e-07, -0.6583691769191123, 0.49967191}, {-1.5163373870938614e-08, 1.0789150406568026e-07, -0.7198475381327679, -1.17748929}, {0.0, 0.0, 2.220446049250313e-16, 1.0}}, {{1.5258788537454444e-07, -1.50434017560616e-08, 0.2139234821857457, -1.25498709}, {-1.016610251610931e-08, -1.5490373090569122e-07, -0.14781717683985668, 0.49967191}, {3.536121881520941e-08, 2.0380342501549018e-08, -0.9656017947376753, -1.17748929}, {0.0, 0.0, 0.0, 1.0}}, {{8.618449605826386e-08, 1.3005744286105568e-07, -0.10926252369460417, -4.776339219999996}, {1.1907386502737676e-07, -6.894646223375916e-08, 0.48119515875463226, 2.2311702599999985}, {5.5049746849940485e-08, -5.4481873383947436e-08, -0.8697775118425347, 0.9207512499999986}, {1.3234889800848443e-23, 2.6469779601696886e-23, 0.0, 1.0}}, {{1.5572529749804938e-07, -9.609244553868475e-09, -0.10926252412771378, -1.29138978}, {-1.7245528181154292e-10, -1.3759422614296728e-07, 0.48119515255296613, 0.38371785999999997}, {-1.9657812971295542e-08, -7.491541593592457e-08, -0.8697775152191327, -0.53911579}, {0.0, 0.0, 1.1102230246251565e-16, 1.0}}, {{1.0510892074207234e-07, 8.792655576224747e-09, -0.7405621389792737, -1.2306127199999985}, {1.1349411496086066e-07, 2.8007369418022736e-08, 0.6673299643797594, -0.6591226399999993}, {2.6608799545244997e-08, -1.5419177904390008e-07, 0.07898377650727657, 4.091492979999998}, {0.0, 0.0, 0.0, 1.0}}, {{1.0510891815648413e-07, 8.79265706901476e-09, -0.7405621607654073, -1.2306127500000001}, {1.1349412013203696e-07, 2.8007366432442717e-08, 0.6673299431834946, -0.6591225800000001}, {2.6608799545245066e-08, -1.5419177904390005e-07, 0.07898375132383044, 4.091492979999997}, {0.0, 1.323488980084842e-23, 0.0, 1.0}}, {{4.4939794689710465e-08, 9.54233248079021e-08, -0.7405621367680707, -2.9126935899999995}, {3.249196924242356e-08, 1.1229246845956814e-07, 0.6673299714231342, -2.1653487399999993}, {1.4683839747935709e-07, -5.405199315156002e-08, 0.07898373773067752, 1.0461139699999995}, {0.0, -2.6469779601696886e-23, 0.0, 0.9999999999999996}}}; +// /* +// The points of the Airocean projection map are deduced from the unfolded net +// of the altered icosahedron defined above. +// The distances in the projected 2d space are expressed in meter. +// */ +// // Define the 23 unfolded surfaces used (from icosahedron + split faces) +constexpr pj_face base_airocean_faces[23] = {{{1.8211859946200586, 3.1543866727148018, 1.0}, {1.8211859946200586, 4.205848896953069, 1.0}, {2.7317789919300877, 3.6801177848339353, 1.0}}, {{1.8211859946200586, 3.1543866727148018, 1.0}, {0.9105929973100293, 3.6801177848339353, 1.0}, {1.8211859946200586, 4.205848896953069, 1.0}}, {{1.8211859946200586, 3.1543866727148018, 1.0}, {0.9105929973100293, 2.628655560595668, 1.0}, {0.9105929973100293, 3.6801177848339353, 1.0}}, {{1.8211859946200586, 3.1543866727148018, 1.0}, {1.8211859946200586, 2.1029244484765344, 1.0}, {0.9105929973100293, 2.628655560595668, 1.0}}, {{1.8211859946200586, 3.1543866727148018, 1.0}, {2.7317789919300877, 3.6801177848339353, 1.0}, {2.7317789919300877, 2.628655560595668, 1.0}}, {{2.7317789919300877, 3.6801177848339353, 1.0}, {1.8211859946200586, 4.205848896953069, 1.0}, {2.7317789919300877, 4.731580009072203, 1.0}}, {{1.8211859946200586, 5.257311121191336, 1.0}, {1.8211859946200586, 4.205848896953069, 1.0}, {0.9105929973100293, 4.731580009072203, 1.0}}, {{0.9105929973100293, 4.731580009072203, 1.0}, {1.8211859946200586, 4.205848896953069, 1.0}, {0.9105929973100293, 3.6801177848339353, 1.0}}, {{0.9105929973100293, 2.628655560595668, 1.0}, {0.0, 3.1543866727148018, 1.0}, {0.9105929973100293, 3.6801177848339353, 1.0}}, {{0.9105929973100293, 2.628655560595668, 1.0}, {0.9105929973100293, 1.5771933363574009, 1.0}, {0.0, 2.1029244484765344, 1.0}}, {{0.9105929973100293, 2.628655560595668, 1.0}, {1.8211859946200586, 2.1029244484765344, 1.0}, {0.9105929973100293, 1.5771933363574009, 1.0}}, {{0.9105929973100293, 1.5771933363574009, 1.0}, {1.8211859946200586, 2.1029244484765344, 1.0}, {1.8211859946200586, 1.0514622242382672, 1.0}}, {{1.8211859946200586, 1.0514622242382672, 1.0}, {1.8211859946200586, 2.1029244484765344, 1.0}, {2.7317789919300877, 1.5771933363574009, 1.0}}, {{1.8211859946200586, 0.0, 1.0}, {1.8211859946200586, 1.0514622242382672, 1.0}, {2.7317789919300877, 0.5257311121191336, 1.0}}, {{0.0, 5.257311121191336, 1.0}, {0.9105929973100293, 4.731580009072203, 1.0}, {0.0, 4.205848896953069, 1.0}}, {{0.0, 1.0514622242382672, 1.0}, {0.0, 2.1029244484765344, 1.0}, {0.9105929973100293, 1.5771933363574009, 1.0}}, {{0.9105929973100293, 0.5257311121191336, 1.0}, {0.9105929973100293, 1.5771933363574009, 1.0}, {1.8211859946200586, 1.0514622242382672, 1.0}}, {{0.9105929973100293, 0.5257311121191336, 1.0}, {1.8211859946200586, 1.0514622242382672, 1.0}, {1.8211859946200586, 0.0, 1.0}}, {{0.9105929973100293, 4.731580009072203, 1.0}, {0.45529649865501465, 4.994445565131769, 1.0}, {0.9105929973100293, 5.78304223331047, 1.0}}, {{0.9105929973100293, 0.5257311121191336, 1.0}, {1.8211859946200586, 0.0, 1.0}, {0.9105929973100293, 0.0, 1.0}}, {{0.0, 4.205848896953069, 1.0}, {0.9105929973100293, 4.731580009072203, 1.0}, {0.6070619982066862, 4.205848896953069, 1.0}}, {{0.9105929973100293, 4.731580009072203, 1.0}, {0.9105929973100293, 3.6801177848339353, 1.0}, {0.6070619982066862, 4.205848896953069, 1.0}}, {{0.0, 3.1543866727148018, 1.0}, {0.3035309991033431, 3.6801177848339353, 1.0}, {0.9105929973100293, 3.6801177848339353, 1.0}}}; + +// /* +// The parameters here are extracted from the transition matrices +// that allow converting a icosahedron face or subface to its +// corresponding face in the Airocean projected space. +// Since only a few parameters of those matrices are relevant, +// the irrelevant ones has been discarded. +// */ +// // Icosahedron to Airocean (forward) +constexpr double base_ico_air_trans[23][4][4] = {{{0.5771127843628077, -0.601949070265588, -0.551904112682031, 2.1247169940181885}, {0.09385435254116901, 0.7202114456801385, -0.6873767816857262, 3.680117788550241}, {0.8112534716456183, 0.3448953244235397, 0.4721387719026189, -0.7946544736643394}, {0.0, 0.0, 0.0, 0.9999999999999999}}, {{0.9709901123098558, -0.21873613013519208, -0.09660585714762573, 1.5176549986755081}, {0.0938543523824071, 0.7202114501390866, -0.68737677703546, 3.6801177840642754}, {0.2199307816724251, 0.6583691769191125, 0.7198475381327677, -0.794654474160402}, {2.7755575615628914e-17, 0.0, 0.0, 1.0}}, {{0.9721374064326862, -0.06476823448972475, 0.2252863218604219, 1.2141239985420345}, {0.09584151545422234, 0.986891659675502, -0.12984315992304857, 3.1543866667568574}, {-0.213923482185746, 0.14781717683985665, 0.9656017947376753, -0.7946544722350559}, {-1.3877787807814457e-16, 2.7755575615628914e-17, 0.0, 1.0}}, {{0.9921258753005284, -0.0010987169074706963, -0.12523993179159917, 1.5176549936500534}, {0.06122047682547376, 0.8766128105888067, 0.4772861192297111, 2.628655561621354}, {0.1092625259373331, -0.48119515565604315, 0.8697775132750618, -0.794654472177355}, {1.1102230246251565e-16, 5.551115123125783e-17, 0.0, 1.0}}, {{0.2803041463023307, -0.5991800450797868, -0.7499419088911223, 2.428247994171984}, {0.6079419973098752, 0.7154153394798394, -0.3443652517634205, 3.1543866696341833}, {0.7428567271237952, -0.3593941714860217, 0.5648005953155497, -0.7946544741179917}, {0.0, 0.0, 0.0, 1.0000000000000002}}, {{0.25960661697438703, -0.758006957058587, -0.5983559612700025, 2.428247993923292}, {-0.4560824568641986, 0.44991125768827994, -0.7678337349017109, 4.205848897582435}, {0.8512303999921013, 0.4722343774266651, -0.22891373682183747, -0.7946544711481622}, {0.0, -5.551115123125783e-17, 1.1102230246251565e-16, 1.0}}, {{0.9586365727166021, -0.25808606588953303, 0.12003128712756019, 1.5176549950590994}, {-0.003215296199617759, -0.4314976538404806, -0.9021083296632684, 4.731580007956949}, {0.2846148074971938, 0.8644080979012073, -0.41447925356542553, -0.7946544719642821}, {0.0, -1.1102230246251565e-16, 0.0, 1.0}}, {{0.9928349393209477, 0.09405867905155406, 0.07370038213709272, 1.2141239979758605}, {0.0560180154856556, 0.1784349297842625, -0.9823558159365612, 4.205848903770237}, {-0.10554981347150151, 0.97944573119741, 0.17188745304792394, -0.794654473006748}, {-1.3877787807814457e-17, 0.0, 8.326672684688674e-17, 1.0}}, {{0.5819727853624432, 0.05026939328855433, 0.811653042180561, 0.6070619975564514}, {0.09584151340049132, 0.9868916600803643, -0.12984315836175953, 3.1543866646549703}, {-0.8075407606993799, 0.15335524153301364, 0.5695261975567214, -0.7946544732451482}, {0.0, -8.326672684688674e-17, 0.0, 1.0}}, {{0.5247823023520097, -0.7686380571359512, 0.36578553967256694, 0.6070619982034591}, {0.00321530314174359, 0.43149765221393604, 0.9021083304165357, 2.1029244497408546}, {-0.8512303999921013, -0.4722343774266651, 0.22891373682183733, -0.7946544711481622}, {1.1102230246251565e-16, 0.0, -2.7755575615628914e-17, 1.0}}, {{0.9586365727166023, -0.25808606588953276, 0.12003128712756019, 1.2141239968709887}, {0.0032152961996172996, 0.43149765384048056, 0.9021083296632679, 2.1029244473612816}, {-0.28461480749719376, -0.8644080979012073, 0.41447925356542553, -0.7946544719642822}, {-5.551115123125783e-17, 0.0, -5.551115123125783e-17, 1.0}}, {{0.9928349393209476, 0.09405867905155432, 0.0737003821370924, 1.5176549939542279}, {-0.05601801548565587, -0.17843492978426267, 0.982355815936562, 1.5771933431745697}, {0.10554981347150151, -0.97944573119741, -0.17188745304792394, -0.794654473006748}, {1.249000902703301e-16, 0.0, -8.326672684688674e-17, 1.0}}, {{0.6696489324143071, 0.7230710222271839, 0.16952465726532903, 2.124716992886465}, {-0.05601802147349406, -0.17843493406754668, 0.9823558148170956, 1.577193342141926}, {0.7405621455042507, -0.6673299596621294, -0.07898375518726183, -0.7946544743360283}, {1.1102230246251565e-16, 0.0, 5.551115123125783e-17, 0.9999999999999999}}, {{0.581972785362443, 0.05026939328855442, 0.8116530421805607, 2.124716994373637}, {-0.09584151340049174, -0.9868916600803641, 0.1298431583617594, 0.5257311040593022}, {0.8075407606993799, -0.15335524153301364, -0.5695261975567214, -0.7946544732451483}, {-1.1102230246251565e-16, -2.7755575615628914e-17, 0.0, 1.0}}, {{0.3863411405466375, 0.9191578807865023, 0.07674189823781499, 0.3035310024438569}, {0.5467215101388645, -0.16119747073988, -0.8216513703440179, 4.731580009447501}, {-0.7428567271237954, 0.35939417148602165, -0.5648005953155498, -0.7946544741179918}, {-1.1102230246251565e-16, 5.551115123125783e-17, 0.0, 1.0}}, {{0.20727613862501068, -0.9246959431881105, 0.31933369857041366, 0.30353100217436535}, {-0.5467215083775467, 0.16119746379435437, 0.8216513728786113, 1.5771933384708474}, {-0.8112534716456183, -0.34489532442353976, -0.4721387719026189, -0.7946544736643393}, {0.0, 1.1102230246251565e-16, 0.0, 1.0}}, {{0.9709901123098558, -0.21873613013519205, -0.09660585714762565, 1.2141239932545798}, {-0.09385435238240734, -0.7202114501390865, 0.6873767770354606, 1.0514622234686084}, {-0.21993078167242508, -0.6583691769191125, -0.7198475381327677, -0.794654474160402}, {0.0, -1.1102230246251565e-16, 0.0, 1.0}}, {{0.9721374064326864, -0.06476823448972478, 0.2252863218604222, 1.5176549933880534}, {-0.09584151545422273, -0.9868916596755019, 0.1298431599230487, 0.5257311061611902}, {0.21392348218574594, -0.14781717683985665, -0.965601794737675, -0.7946544722350558}, {-1.3877787807814457e-16, -2.7755575615628914e-17, 0.0, 1.0}}, {{0.5490814341445536, 0.7586196137281238, 0.3507219468201455, 0.6070619971385178}, {0.828595975697076, -0.43925791880424425, -0.34710402061504564, 5.257311122022961}, {-0.10926252369460446, 0.4811951587546325, -0.8697775118425342, -0.7946544734171301}, {8.326672684688674e-17, 0.0, 0.0, 0.9999999999999998}}, {{0.9921258803454628, -0.001098726158448999, -0.1252399351953353, 1.2141239965994974}, {-0.061220481001961057, -0.8766128044664807, -0.4772861112510543, 6.962719666473e-09}, {-0.10926252412771358, 0.48119515255296597, -0.8697775152191325, -0.79465447341713}, {-4.163336342344337e-17, -1.1102230246251565e-16, 0.0, 0.9999999999999999}}, {{0.6696489432944074, 0.7230710163882418, 0.16952466434270155, 0.6070620106869362}, {0.05601800780331223, 0.1784349479222583, -0.9823558101673974, 4.205848888056709}, {-0.7405621389792741, 0.6673299643797597, 0.07898377650727716, -0.7946544674186218}, {1.1102230246251565e-16, 0.0, -1.3877787807814457e-17, 1.0}}, {{0.6696489098267326, 0.7230710312696226, 0.16952465761975835, 0.6070619835219269}, {0.056018019261034786, 0.1784349316785832, -0.9823558153771896, 4.205848903740433}, {-0.7405621607654075, 0.6673299431834948, 0.07898375132383098, -0.7946544674186217}, {1.1102230246251565e-16, -1.1102230246251565e-16, 2.7755575615628914e-17, 0.9999999999999999}}, {{0.28631142864032966, 0.20700633361637605, 0.9355074196454307, 0.3035309858829332}, {0.6079420159049573, 0.7154153325157111, -0.34436525612985447, 3.680117806877694}, {-0.7405621367680707, 0.667329971423134, 0.07898373773067754, -0.7946544674186213}, {0.0, 0.0, 8.326672684688674e-17, 1.0}}}; +// // Airocean to Icosahedron (inverse) +constexpr double base_air_ico_trans[23][4][4] = {{{0.5771127842542352, 0.09385434657102582, 0.8112534716456185, -0.9269301900000004}, {-0.6019490778198661, 0.7202114470147596, 0.3448953244235397, -1.0974189100000002}, {-0.5519041069771089, -0.6873767724024487, 0.47213877190261855, 4.077454710000002}, {0.0, 2.2204460492503126e-16, 0.0, 1.0}}, {{0.9709901268864738, 0.09385434657102582, 0.2199307816724253, -1.6442540899999996}, {-0.2187361374273623, 0.7202114470147596, 0.6583691769191118, -1.79532095}, {-0.09660585493174938, -0.687376772402449, 0.7198475381327685, 3.24827191}, {1.1102230246251565e-16, 0.0, 1.1102230246251565e-16, 1.0}}, {{0.9721374177212223, 0.09584151258786845, -0.21392348218574572, -1.6526118100000005}, {-0.06476823913013299, 0.9868916696001585, 0.14781717683985673, -2.9169376699999994}, {0.22528632507169927, -0.12984316207736876, 0.9656017947376752, 0.9033697900000001}, {1.1102230246251565e-16, 0.0, 0.0, 1.0}}, {{0.9921258758509998, 0.061220487542130664, 0.10926252593733322, -1.5798064099999996}, {-0.001098707109494417, 0.8766128052462792, -0.4811951556560428, -2.685029549999999}, {-0.12523992644012408, 0.4772861149277753, 0.8697775132750616, -0.3733772099999991}, {0.0, -2.465190328815662e-32, 0.0, 1.0000000000000002}}, {{0.28030414329344755, 0.6079419928405788, 0.7428567271237952, -2.00801767}, {-0.5991800415902347, 0.7154153355770391, -0.35939417148602165, -1.0873330499999998}, {-0.7499419027132015, -0.3443652483685888, 0.5648005953155497, 3.356127390000001}, {-1.1102230246251565e-16, 1.1102230246251565e-16, 0.0, 1.0}}, {{0.2596066197503542, -0.4560824620660179, 0.8512303999921011, 1.9642587099999997}, {-0.7580069603423448, 0.44991126556421224, 0.47223437742666524, 0.3236332399999994}, {-0.5983559577215728, -0.7678337379974675, -0.22891373682183738, 4.50044201}, {-1.1102230246251565e-16, -1.1102230246251565e-16, 0.0, 1.0}}, {{0.9586365671366947, -0.003215303338595427, 0.2846148074971937, -1.213495679999999}, {-0.25808606116480587, -0.431497651119788, 0.8644080979012073, 3.12025702}, {0.1200312931494973, -0.9021083288913834, -0.4144792535654252, 3.7568638500000016}, {0.0, -1.6653345369377373e-16, 0.0, 1.0}}, {{0.9928349412643155, 0.056018018186692914, -0.10554981347150141, -1.524903679999999}, {0.09405867962197714, 0.17843493154109227, 0.97944573119741, -0.08634833000000003}, {0.07370038008007025, -0.9823558242886872, 0.1718874530479236, 4.178749899999999}, {-1.1102230246251565e-16, 0.0, 0.0, 0.9999999999999996}}, {{0.5819727875851122, 0.0958415125878687, -0.8075407606993801, -1.2973306300000007}, {0.05026939053476542, 0.9868916696001588, 0.1533552415330134, -3.0216901300000005}, {0.8116530460736279, -0.12984316207736876, 0.5695261975567216, 0.36942835999999946}, {-1.1102230246251565e-16, -2.220446049250313e-16, 0.0, 1.0}}, {{0.5247823082449008, 0.0032153033385950414, -0.851230399992101, -1.0017709799999996}, {-0.7686380655985867, 0.43149765111978794, -0.4722343774266652, -0.81605916}, {0.3657855441277853, 0.9021083288913834, 0.2289137368218374, -1.9372128400000004}, {0.0, 6.096153978258407e-17, 0.0, 0.9999999999999998}}, {{0.9586365671366951, 0.0032153033385950484, -0.28461480749719337, -1.39683563}, {-0.2580860611648058, 0.43149765111978794, -0.8644080979012073, -1.28096424}, {0.12003129314949779, 0.9021083288913836, 0.41447925356542553, -1.7134307400000008}, {-1.1102230246251565e-16, 1.1102230246251565e-16, 0.0, 1.0}}, {{0.9928349412643155, -0.05601801818669286, 0.1055498134715019, -1.33455403}, {0.09405867962197711, -0.17843493154109227, -0.9794457311974099, -0.6396431699999997}, {0.07370038008007082, 0.9823558242886878, -0.17188745304792374, -1.7978079500000004}, {1.1102230246251565e-16, -2.220446049250313e-16, 0.0, 0.9999999999999998}}, {{0.6696489285568152, -0.05601801818669308, 0.7405621455042509, -0.74597219}, {0.723071017397498, -0.1784349315410924, -0.6673299596621297, -1.7851916300000001}, {0.16952466190275595, 0.982355824288688, -0.0789837551872621, -1.9723217899999996}, {0.0, -1.1102230246251565e-16, 0.0, 1.0}}, {{0.581972787585112, -0.09584151258786852, 0.80754076069938, -0.54442473}, {0.05026939053476491, -0.9868916696001588, -0.15335524153301358, 0.29016699000000007}, {0.8116530460736278, 0.12984316207736893, -0.5695261975567216, -2.2453721499999997}, {0.0, -1.1102230246251565e-16, 0.0, 1.0}}, {{0.386341138180555, 0.5467215052984484, -0.7428567271237957, -3.2944374800000005}, {0.9191578756618027, -0.16119746966924034, 0.35939417148602165, 0.7693200000000001}, {0.07674189808886517, -0.8216513632963648, -0.5648005953155493, 3.415594300000001}, {-1.1102230246251565e-16, 0.0, 0.0, 1.0}}, {{0.2072761437410203, -0.5467215052984483, -0.8112534716456183, 0.15470457999999998}, {-0.9246959481210651, 0.16119746966924028, -0.34489532442353976, -0.2476383}, {0.31933369338332074, 0.8216513632963647, -0.47213877190261877, -1.7680179200000001}, {0.0, 0.0, 0.0, 1.0}}, {{0.970990126886474, -0.09385434657102576, -0.2199307816724251, -1.25498709}, {-0.21873613742736212, -0.7202114470147594, -0.6583691769191123, 0.49967191}, {-0.09660585493174975, 0.6873767724024488, -0.7198475381327678, -1.17748929}, {0.0, 0.0, 0.0, 1.0}}, {{0.9721374177212225, -0.09584151258786833, 0.21392348218574608, -1.25498709}, {-0.06476823913013245, -0.9868916696001586, -0.14781717683985665, 0.49967190999999994}, {0.225286325071699, 0.12984316207736882, -0.9656017947376753, -1.17748929}, {1.1102230246251565e-16, 0.0, 0.0, 0.9999999999999999}}, {{0.5490814243871979, 0.828595968467787, -0.10926252369460442, -4.7763392200000006}, {0.7586195940894178, -0.4392579108912803, 0.4811951587546326, 2.2311702599999994}, {0.3507219371809713, -0.3471040153291294, -0.8697775118425345, 0.92075125}, {0.0, -1.1102230246251565e-16, 0.0, 0.9999999999999991}}, {{0.9921258703600726, -0.061220497052696075, -0.10926252412771353, -1.29138978}, {-0.0010987126004213489, -0.8766128147568447, 0.4811951525529661, 0.3837178600000002}, {-0.12523992644012394, -0.4772861149277757, -0.8697775152191326, -0.5391157899999999}, {0.0, 0.0, 0.0, 1.0}}, {{0.6696489340477428, 0.05601800867612728, -0.7405621389792739, -1.230612719999998}, {0.7230710064156433, 0.17843495056222272, 0.6673299643797593, -0.659122639999999}, {0.1695246619027561, -0.9823558242886863, 0.07898377650727674, 4.091492979999993}, {-2.220446049250313e-16, 4.440892098500626e-16, 0.0, 1.0}}, {{0.6696489175749601, 0.05601801818669295, -0.7405621607654072, -1.230612749999999}, {0.723071039361207, 0.17843493154109233, 0.6673299431834945, -0.659122579999999}, {0.1695246619027577, -0.9823558242886873, 0.07898375132383063, 4.091492979999996}, {4.440892098500626e-16, 7.186231688523656e-17, 0.0, 0.9999999999999996}}, {{0.28631143196814535, 0.6079420023511448, -0.7405621367680713, -2.9126935900000026}, {0.20700633604348043, 0.7154153165559092, 0.6673299714231338, -2.165348740000002}, {0.9355074303409838, -0.34436524836858934, 0.07898373773067771, 1.0461139700000008}, {0.0, 0.0, 0.0, 1.0000000000000009}}}; // By default the resulting orientation of the projection is vertical // the following transforms are used to alter the projection data // so that the resulting orientation is horizontal instead -constexpr double orient_horizontal_trans[4][4] = {{0.0, -1.0, 0.0, 36843762.068421006}, {1.0, 0.0, 0.0, 0.0}, {0.0, 0.0, 1.0, 0.0}, {0.0, 0.0, 0.0, 1.0}}; -constexpr double orient_horizontal_inv_trans[4][4] = {{0.0, 1.0, 0.0, 0.0}, {-1.0, -0.0, -0.0, 36843762.068421006}, {0.0, 0.0, 1.0, 0.0}, {0.0, 0.0, 0.0, 1.0}}; +constexpr double orient_horizontal_trans[4][4] = {{0.0, -1.0, 0.0, 5.78304223331047}, {1.0, 0.0, 0.0, 0.0}, {0.0, 0.0, 1.0, 0.0}, {0.0, 0.0, 0.0, 1.0}}; +constexpr double orient_horizontal_inv_trans[4][4] = {{0.0, 1.0, 0.0, 0.0}, {-1.0, -0.0, -0.0, 5.78304223331047}, {0.0, 0.0, 1.0, 0.0}, {0.0, 0.0, 0.0, 1.0}}; + namespace { // anonymous namespace @@ -236,6 +236,7 @@ static PJ_XY airocean_forward(PJ_LP lp, PJ *P) { } else { lat = lp.phi; } + lat = lp.phi; // Convert the lat/long to x,y,z on the unit sphere double x, y, z; @@ -269,6 +270,7 @@ static PJ_LP airocean_inverse(PJ_XY xy, PJ *P) { PJ_LP lp = {0.0, 0.0}; + unsigned char face_id = get_dym_face_index(Q, &xy); if (face_id == 23) { @@ -327,17 +329,11 @@ PJ *PJ_PROJECTION(airocean) { proj_log_error( P, _("Invalid value for orient: only vertical or horizontal are supported")); - return pj_default_destructor(P, - PROJ_ERR_INVALID_OP_ILLEGAL_ARG_VALUE); + return pj_default_destructor(P, PROJ_ERR_INVALID_OP_ILLEGAL_ARG_VALUE); } } - - P->left = PJ_IO_UNITS_RADIANS; - P->right = PJ_IO_UNITS_PROJECTED; - P->from_greenwich = -P->lam0; - P->inv = airocean_inverse; P->fwd = airocean_forward; diff --git a/test/gie/builtins.gie b/test/gie/builtins.gie index c415a0ab19..8e1af31568 100644 --- a/test/gie/builtins.gie +++ b/test/gie/builtins.gie @@ -1173,200 +1173,198 @@ operation +proj=airocean +ellps=GRS80 ------------------------------------------------------------------------------- tolerance 0.1 mm accept 23 28 -expect 13556926.823490718 23467359.674033195 -accept 72 46 -expect 9643052.686797861 23470487.369125906 -accept 145 75 -expect 7737390.782312192 20104788.054769896 +expect 13563292.104339601 23482667.52366777 +accept 71 46 +expect 9712436.387570003 23471344.069491874 +accept 147 75 +expect 7730995.346116073 20083085.872351483 accept -77 61 -expect 9668545.797051517 16783947.67041814 +expect 9675662.250363283 16816726.593429103 accept -26 35 -expect 15441270.037205558 20068684.009483118 +expect 15444035.232702088 20084523.97367342 accept 29 -13 -expect 15454500.775444025 26772291.248060163 -accept 72 -25 -expect 9646854.070149897 30174627.37899145 -accept 96 10 -expect 7748510.227719365 26793197.86531571 +expect 15476385.91184963 26808151.021032616 +accept 71 -25 +expect 9735422.127044765 30232067.866410717 +accept 97 10 +expect 7670751.024555227 26810815.09133769 accept 169 35 -expect 3879364.926075886 20112884.602338977 +expect 3899481.1285664076 20132853.072642263 accept -151 13 -expect 3855457.9788894877 13372404.237126907 -accept -108 25 -expect 7757309.887436695 13427462.802436445 -accept -84 -10 -expect 9655653.729867224 10046033.288760712 -accept -42 -5 -expect 13531956.757129436 10009950.782333512 -accept -11 -35 -expect 13524799.031510707 3365720.025783973 -accept 154 -35 -expect 1943420.8175922546 30184052.521318957 -accept -157 -28 -expect 1942090.2539895012 10076591.20216224 -accept -108 -46 -expect 7761111.270788729 6723322.792570909 -accept -35 -75 -expect 9666773.175274398 3357623.4782149 -accept 98 -48 -expect 4871988.820643149 32910398.56714167 -accept 113 -72 -expect 7725850.483813245 1088496.8256700835 +expect 3862573.080611173 13394278.635916904 +accept -109 24 +expect 7676078.21222692 13378512.802501509 +accept -84 -9 +expect 9672617.425701782 10139722.086610688 +accept -42 -4 +expect 13561660.891162189 10105434.745812869 +accept -11 -34 +expect 13611498.820767328 3381116.836737874 +accept 155 -35 +expect 1871907.165749564 30227262.371780526 +accept -158 -28 +expect 1866236.5572882898 10102727.810050495 +accept -109 -46 +expect 7711224.276681991 6705418.7782009095 +accept -36 -75 +expect 9658514.588242078 3376747.6550830416 +accept 98 -49 +expect 4793576.034721544 33018978.58637787 +accept 114 -72 +expect 7713241.162446838 1111211.0119130726 accept 143 -9 -expect 3215425.0474725077 27916795.439275663 -accept 124 7 -expect 5140625.112062726 26778848.513305675 -accept 147 15 -expect 2546085.5873131985 22379298.380909223 +expect 3218042.2064498146 27953548.53981338 +accept 123 7 +expect 5239800.309588053 26817770.853363615 +accept 147 16 +expect 2644879.1822013017 22370411.86848925 direction inverse -accept 13500000 23400000 -expect 23.028334260781396 29.00141845366607 -accept 9700000 23400000 -expect 70.91748976033631 46.69938767448572 +accept 13600000 23500000 +expect 22.773464572867294 27.745464716163056 +accept 9700000 23500000 +expect 71.26673015453744 45.89205035000612 accept 7700000 20100000 -expect 145.97790022956485 74.66181692499651 -accept 9700000 16700000 -expect -76.80102747900565 59.99374652248361 +expect 146.99339922501423 74.69909786744657 +accept 9700000 16800000 +expect -76.55528558395834 60.90966581108546 accept 15500000 20100000 -expect -25.944389921688217 34.24636404674132 +expect -26.12578972754671 34.53133514828208 accept 15500000 26800000 -expect 28.780505935021033 -13.567140588707066 -accept 9700000 30100000 -expect 71.4679674085186 -24.079311453738754 +expect 28.725667463887856 -13.176397639962207 +accept 9700000 30200000 +expect 71.49135800157006 -24.84162686346212 accept 7700000 26800000 -expect 96.5497950965985 9.88121445991218 +expect 96.67476476615902 10.2142651287627 accept 3900000 20100000 -expect 169.13009208849755 35.254403049754224 +expect 169.44670563079603 35.245717282501886 accept 3900000 13400000 -expect -150.64046965868116 13.481494624013168 +expect -150.62222998696532 13.30459957043187 accept 7700000 13400000 -expect -108.66196431422468 24.604190039126202 -accept 9700000 10000000 -expect -83.45176986114532 -10.484774451578211 -accept 13500000 10000000 -expect -42.33857403889376 -5.173528026525927 -accept 13500000 3300000 -expect -10.156579309260813 -35.39429168339308 -accept 1900000 30100000 -expect 154.6981118584859 -34.09548216619245 -accept 1900000 10000000 -expect -157.1486568493204 -28.983938091775162 +expect -108.74281291121734 24.42206777180953 +accept 9700000 10100000 +expect -83.65325195956459 -9.486900270831473 +accept 13600000 10100000 +expect -41.56143018608222 -4.0134930004162905 +accept 13600000 3400000 +expect -11.279583156676242 -34.272615899757646 +accept 1900000 30200000 +expect 154.64715191651544 -34.84574835325207 +accept 1900000 10100000 +expect -157.5838766673165 -28.052389401329638 accept 7700000 6700000 -expect -109.0368655953666 -46.16466623109972 -accept 9700000 3300000 -expect -32.11127170743792 -74.98612150074251 -accept 4800000 32900000 -expect 98.90848938837188 -48.50784207235999 +expect -109.19369483087058 -46.23421830390136 +accept 9700000 3400000 +expect -35.930097311957454 -74.56175815714317 +accept 4800000 33000000 +expect 98.17201357657596 -49.00298561876853 accept 7700000 1100000 -expect 114.00231130949376 -71.99425265168686 +expect 114.2610931478263 -71.9419539648052 accept 3200000 27900000 -expect 143.20066829467564 -8.847739058325072 +expect 143.30076634375794 -8.522097310935342 accept 5200000 26800000 -expect 123.33794956763194 6.861286881197438 -accept 2600000 22300000 -expect 147.63769509437498 15.818879769693432 -accept 0 0 -expect failure +expect 123.44730424516767 7.179239007940713 +accept 2600000 22400000 +expect 146.85478120098927 15.54230419284032 ------------------------------------------------------------------------------- -operation +proj=airocean +orient=horizontal +ellps=GRS80 +operation +proj=airocean +orient=horizontal +ellps=GRS80 ------------------------------------------------------------------------------- tolerance 0.1 mm -accept 23 29 -expect 13445038.138395257 13501788.272168122 -accept 71 47 -expect 13469321.22856612 9691162.310202885 -accept 146 75 -expect 16758940.408539249 7725947.54927852 -accept -77 60 -expect 20145508.681780424 9691320.12928607 -accept -26 34 -expect 16738437.29206201 15521444.12245347 -accept 29 -14 -expect 10002182.5715067 15508486.660989888 -accept 71 -24 -expect 6745544.686885769 9738408.304902693 +accept 23 28 +expect 13402368.117172362 13563292.104339601 +accept 71 46 +expect 13413691.571348265 9712436.387570003 +accept 147 75 +expect 16801949.768488657 7730995.346116073 +accept -77 61 +expect 20068309.047411036 9675662.250363283 +accept -26 35 +expect 16800511.667166725 15444035.232702088 +accept 29 -13 +expect 10076884.619807519 15476385.91184963 +accept 71 -25 +expect 6652967.774429418 9735422.127044765 accept 97 10 -expect 10057167.426204873 7661719.142318802 +expect 10074220.54950245 7670751.024555227 accept 169 35 -expect 16730877.466082027 3879364.926075886 +expect 16752182.568197876 3899481.1285664076 accept -151 13 -expect 23471357.831294097 3855457.9788894877 -accept -109 25 -expect 23405563.0692953 7677848.871802735 -accept -83 -10 -expect 26804332.00275987 9742444.815267786 -accept -42 -5 -expect 26833811.28608749 13531956.757129436 -accept -10 -35 -expect 33549702.824863963 13536077.88916722 -accept 155 -34 -expect 6754064.240713957 1878658.9644939895 -accept -157 -29 -expect 26849240.124435734 1910219.231732698 +expect 23490757.004923232 3862573.080611173 +accept -109 24 +expect 23506522.83833863 7676078.21222692 +accept -84 -9 +expect 26745313.55422945 9672617.425701782 +accept -42 -4 +expect 26779600.89502727 13561660.891162189 +accept -11 -34 +expect 33503918.804102264 13611498.820767328 +accept 155 -35 +expect 6657773.269059614 1871907.165749564 +accept -158 -28 +expect 26782307.830789648 1866236.5572882898 accept -109 -46 -expect 30129033.055957943 7700118.744271104 -accept -32 -75 -expect 33546604.455268644 9700086.856617931 -accept 99 -49 -expect 3917784.3424766464 4762210.008135711 +expect 30179616.862639237 7711224.276681991 +accept -36 -75 +expect 33508287.985757098 9658514.588242078 +accept 98 -49 +expect 3866057.054462265 4793576.034721544 accept 114 -72 -expect 35743305.80505435 7700279.4959819885 +expect 35773824.62892707 7713241.162446838 accept 143 -9 -expect 8926966.62914534 3215425.0474725077 +expect 8931487.101026757 3218042.2064498146 accept 123 7 -expect 10051797.28039541 5233302.981464034 -accept 148 16 -expect 14580207.201673953 2606103.035139274 +expect 10067264.787476515 5239800.309588053 +accept 147 16 +expect 14514623.772350889 2644879.1822013017 direction inverse -accept 13400000 13500000 -expect 23.38101068889326 28.613417194415643 -accept 13500000 9700000 -expect 70.7802085458946 47.32843064371629 +accept 13400000 13600000 +expect 22.653513769488086 27.87758783216759 +accept 13400000 9700000 +expect 71.2321304889103 46.059446219758996 accept 16800000 7700000 -expect 148.10287981014486 74.96215466929766 +expect 147.55671428761954 74.77832978870643 accept 20100000 9700000 -expect -76.54133367948258 60.47011202998829 -accept 16700000 15500000 -expect -25.402102068835045 34.038552037244074 -accept 10000000 15500000 -expect 29.093669699644725 -13.960206072298153 +expect -76.64598920724659 60.74702065186206 +accept 16800000 15500000 +expect -26.312406534624202 34.601485943337174 +accept 10100000 15500000 +expect 28.619135102825094 -13.042018792349772 accept 6700000 9700000 -expect 71.39502686260073 -24.572248553401327 +expect 71.51626100204493 -24.67325245320244 accept 10100000 7700000 -expect 96.5989815165186 10.519796023191507 -accept 16700000 3900000 -expect 168.5332718079372 35.173954828735 +expect 96.68789664137729 10.383985622857828 +accept 16800000 3900000 +expect 169.65090708283734 35.27199215229812 accept 23500000 3900000 -expect -150.39605816066683 12.8877109123015 -accept 23400000 7700000 -expect -108.73571568748467 25.097014645260366 +expect -150.55720916463775 13.146791299175973 +accept 23500000 7700000 +expect -108.7176824122098 24.2537259740474 accept 26800000 9700000 -expect -83.48998116482932 -9.98785063836723 -accept 26800000 13500000 -expect -42.42285754320226 -4.68222695695373 -accept 33500000 13500000 -expect -10.755116011311662 -35.31735130903507 -accept 6800000 1900000 -expect 154.76504012111806 -33.459989505310055 +expect -83.64031637356378 -9.656648231646493 +accept 26800000 13600000 +expect -41.532483451278324 -4.181271534515257 +accept 33500000 13600000 +expect -11.07799815066552 -34.30009865557726 +accept 6700000 1900000 +expect 154.6653022372498 -34.676851362562076 accept 26800000 1900000 -expect -157.35174676612695 -28.520246787409704 -accept 30100000 7700000 -expect -108.93360340357648 -45.67479874983113 +expect -157.51535351022102 -28.21093854274684 +accept 30200000 7700000 +expect -109.22990596539768 -46.40145478575142 accept 33500000 9700000 -expect -33.77121014744891 -74.7525617691622 +expect -35.38695615427261 -74.64821445477583 accept 3900000 4800000 -expect 98.35846530162404 -48.821443120344455 -accept 35700000 7700000 -expect 114.65803383575242 -72.41879106994266 -accept 8900000 3200000 -expect 143.1150335988881 -9.311213341657826 +expect 98.36200826776671 -48.896293330184925 +accept 35800000 7700000 +expect 114.04214974826021 -71.7963489850827 +accept 9000000 3200000 +expect 143.33006361554604 -8.363015677507919 accept 10100000 5200000 -expect 123.42786172727975 7.474238270475286 -accept 14600000 2600000 -expect 148.23146560737166 16.00099471760901 +expect 123.47123953807082 7.342196463300299 +accept 14500000 2600000 +expect 147.01335050858833 15.591840264443174 accept 0 0 expect failure