a trilinear interplation.
vp = interp3(xp,yp,zp,x,y,z,v)
The function interp3 is a trilinear interpolation, it computes the weighted sum of the function values.
func = "v=2*(x-0.5).*(y-0.5) + 4*(z-0.5)"; deff("v=f(x,y,z)",func); n = 5; x = linspace(0,1,n); y=x; z=x; [X,Y,Z] = ndgrid(x,y,z); V = f(X,Y,Z); // compute (and display) the linear interpolant on some slices m = 10; Xp = linspace(0,1,m); Yp=Xp; Zp=Xp; Vp = interp3(Xp,Yp,Zp, x, y, z, V); V_exact = f(Xp,Yp,Zp); norm(Vp -V_exact) < 10e-14 | ![]() | ![]() |
for more details see CGAL Manual.
This function uses the Interpolation package of CGAL, which is under QPL license. See License Terms