[ANN] Meshes.jl - Computational Geometry in Julia

Meshes.jl v0.57

Thanks to the work of various contributors (Michael Ingold, Guillaume Dalle, Kyle Beggs, Joshua Lampert, Pablo San-Jose, Zoïs Moitier), we now have full support for differential and integral calculus with Meshes.jl geometries and domains:

Click to see code
using Meshes
using CoordRefSystems

import GLMakie as Mke

# curved quadrangle over the globe
q = Quadrangle(Point(LatLon(0, 0)), Point(LatLon(0, 90)), Point(LatLon(80, 90)), Point(LatLon(80, 0)))

# Jacobian components as rays over the quadrangle
uv = Iterators.product(0:0.1:1, 0:0.1:1)
rs = [Ray.(q(u, v), 0.05 .* jacobian(q, (u, v))) for (u, v) in uv]

# split rays into u and v components
rᵤ = first.(rs) |> vec
rᵥ = last.(rs) |> vec

viz(q, color="teal")
viz!(rᵤ, color="gray80")
viz!(rᵥ, color="gray80")

# Bezier curve over the globe
c = BezierCurve(Point(LatLon(0, 0)), Point(LatLon(40, 90)), Point(LatLon(80, 0)))

# Jacobian components as rays over the curve
ts = 0:0.1:1
rs = [Ray.(c(t), 0.05 .* jacobian(c, (t,))) for t in ts]

# extract t component
rₜ = first.(rs) |> vec

viz!(c, color="yellow", segmentsize=4)
viz!(rₜ, color="magenta")

Mke.current_figure()

We support any differentiation backend from DifferentiationInterface.jl and any integration backend from IntegrationInterface.jl, and use ForwardDiff.jl and HAdaptiveIntegration.jl by default.

We use this new feature to compute lengths and areas of curved geometries with unprecedented accuracy (automatic differentiation + h-adaptive integration) given that

area(g) = integral(_ -> 1, g)

Please let us know if you encounter any problems.

21 Likes