# Trilinear interpolation in Julia?

I need a package for graphics applications. Which package contains spatial mappings such as trilinear interpolation?

Seems like Dierckx.jl has 2D splines for unstructured points, if that suits your needs.

1 Like

Are you asking for ternary plots?

1 Like

I need 3d trilinear interpolation for spatial data.

We don’t have trilinear interpolation specifically, but it should be quite straightforward to write such solver in the GeoStats.jl ecosystem, which already supports 3D unstructured grids: Built-in · GeoStats.jl

The unstructured grids are coming from the Meshes.jl package, which is another package I am actively working on: GitHub - JuliaGeometry/Meshes.jl: Computational geometry and meshing algorithms in Julia

We’ve designed these interpolation methods in GeoStats.jl in a way that they work with any Hilbert space. This means that you can interpolate any Julia type with well-defined scalar product, vector addition and inner product.

2 Likes

For trilinear interpolation, I think you can use `Interpolations.jl`:

``````using Interpolations
f(x,y,z) = 2x + 3y + 5z
x = y = z = -10:5.0:10
v = [f(x,y,z) for x in x, y in y, z in z]
itp = interpolate((x,y,z),v, Gridded(Linear()))
itp(1.,1.,1.) ≈ f(1.,1.,1.)     # true  (= 10.0)
``````