@@ -329,81 +329,6 @@ coordinate_summary(topo, Δ::Union{AbstractVector, AbstractMatrix}, name) =
329329@inline column_depthᶜᶠᵃ (i, j, k, grid, η) = static_column_depthᶜᶠᵃ (i, j, grid)
330330@inline column_depthᶠᶠᵃ (i, j, k, grid, η) = static_column_depthᶠᶠᵃ (i, j, grid)
331331
332- # ####
333- # #### Spherical geometry
334- # ####
335-
336- """
337- spherical_area_triangle(a::Number, b::Number, c::Number)
338-
339- Return the area of a spherical triangle on the unit sphere with sides `a`, `b`, and `c`.
340-
341- The area of a spherical triangle on the unit sphere is ``E = A + B + C - π``, where ``A``, ``B``, and ``C``
342- are the triangle's inner angles.
343-
344- It has been known since the time of Euler and Lagrange that
345- ``\\ tan(E/2) = P / (1 + \\ cos a + \\ cos b + \\ cos c)``, where
346- ``P = (1 - \\ cos²a - \\ cos²b - \\ cos²c + 2 \\ cos a \\ cos b \\ cos c)^{1/2}``.
347-
348- References
349- ==========
350-
351- * Euler, L. (1778) De mensura angulorum solidorum, Opera omnia, 26, 204-233 (Orig. in Acta adac. sc. Petrop. 1778)
352- * Lagrange, J.-L. (1798) Solutions de quilquies problèmes relatifs au triangles sphéruques, Oeuvres, 7, 331-359.
353- """
354- function spherical_area_triangle (a:: Number , b:: Number , c:: Number )
355- cosa = cos (a)
356- cosb = cos (b)
357- cosc = cos (c)
358-
359- tan½E = sqrt (1 - cosa^ 2 - cosb^ 2 - cosc^ 2 + 2 cosa * cosb * cosc)
360- tan½E /= 1 + cosa + cosb + cosc
361-
362- return 2 atan (tan½E)
363- end
364-
365- """
366- spherical_area_triangle(a::AbstractVector, b::AbstractVector, c::AbstractVector)
367-
368- Return the area of a spherical triangle on the unit sphere with vertices given by the 3-vectors
369- `a`, `b`, and `c` whose origin is the the center of the sphere. The formula was first given by
370- Eriksson (1990).
371-
372- If we denote with ``A``, ``B``, and ``C`` the inner angles of the spherical triangle and with
373- ``a``, ``b``, and ``c`` the side of the triangle then, it has been known since Euler and Lagrange
374- that ``\\ tan(E/2) = P / (1 + \\ cos a + \\ cos b + \\ cos c)``, where ``E = A + B + C - π`` is the
375- triangle's excess and ``P = (1 - \\ cos²a - \\ cos²b - \\ cos²c + 2 \\ cos a \\ cos b \\ cos c)^{1/2}``.
376- On the unit sphere, ``E`` is precisely the area of the spherical triangle. Erikkson (1990) showed
377- that ``P`` above is the same as the volume defined by the vectors `a`, `b`, and `c`, that is
378- ``P = |𝐚 \\ cdot (𝐛 \\ times 𝐜)|``.
379-
380- References
381- ==========
382-
383- * Eriksson, F. (1990) On the measure of solid angles, Mathematics Magazine, 63 (3), 184-187, doi:10.1080/0025570X.1990.11977515
384- """
385- function spherical_area_triangle (a₁:: AbstractVector , a₂:: AbstractVector , a₃:: AbstractVector )
386- (sum (a₁.^ 2 ) ≈ 1 && sum (a₂.^ 2 ) ≈ 1 && sum (a₃.^ 2 ) ≈ 1 ) || error (" a₁, a₂, a₃ must be unit vectors" )
387-
388- tan½E = abs (dot (a₁, cross (a₂, a₃)))
389- tan½E /= 1 + dot (a₁, a₂) + dot (a₂, a₃) + dot (a₁, a₃)
390-
391- return 2 atan (tan½E)
392- end
393-
394- """
395- spherical_area_quadrilateral(a₁, a₂, a₃, a₄)
396-
397- Return the area of a spherical quadrilateral on the unit sphere whose points are given by 3-vectors,
398- `a`, `b`, `c`, and `d`. The area of the quadrilateral is given as the sum of the ares of the two
399- non-overlapping triangles. To avoid having to pick the triangles appropriately ensuring they are not
400- overlapping, we compute the area of the quadrilateral as the half the sum of the areas of all four potential
401- triangles formed by `a₁`, `a₂`, `a₃`, and `a₄`.
402- """
403- spherical_area_quadrilateral (a:: AbstractVector , b:: AbstractVector , c:: AbstractVector , d:: AbstractVector ) =
404- 1 / 2 * (spherical_area_triangle (a, b, c) + spherical_area_triangle (a, b, d) +
405- spherical_area_triangle (a, c, d) + spherical_area_triangle (b, c, d))
406-
407332"""
408333 add_halos(data, loc, topo, sz, halo_sz; warnings=true)
409334
0 commit comments