LabVIEW Idea Exchange

cancel
Showing results for 
Search instead for 
Did you mean: 
altenbach

Interpolate array for higher dimensions (bilinear, trilinear)

Status: New

Interpolate 1D array is very similar to index array, except it accepts a fractional index and will return a linearly interpolated value. (For integer indices, the results are the same). As the name suggests, this only works for 1D arrays.

 

I suggest that the functionality should be expanded for higher dimension arrays. The equivalent function for 2D arrays is bilinear interpolation and for 3D arrays it is trilinear interpolation. In the past I have written simple drafts for replacement code, but I think the "Interpolate 1D array" should be renamed simply to "Interpolate Array" and made polymorphic to accept up to at least 3D arrays.

 

An example of bilinear interpolation of a 2D array can be found here.

An example for trilinear interpolation of a 3D array can be found here.

(SInce I wrote both, they would need to be verified for correct operation and enhanced with exception handling, etc. ;))

 

These functions are useful to e.g. extract a profile along an arbitrary line in 2D (example) or 3D, or an arbitrary cutting plane in 3D.

They can also be used to resample an existing array (1D, 2D, 3D) at a different grid spacing.

 

Here's an example for resampling a very coarse 2D array at 10x higher rate (posted here).

 

 

 

(True, we also have the interpolation palette and some of the above 1D or 2D functions could probably be achieved with a detailed reading of the help and some extra code. None have the simplicity of "index array" with fractional indices.)

 

My suggestion is extend the functionality of interpolate array in the array palette to also accept at least 2D and 3D arrays.


3 Comments
Rufnek
Member

Hello,

 

It is a very good idea !

I think that LabView is missing some functionnalities on this point.

 

Thank you altenbach for your idea, I hope NI engineers can implement this work. 🙂

altenbach
Knight of NI

Of course it would be cool if the resemblance to "index array" would also include to allow unwired indices for higher dimensional arrays. We could get an entire interpolated row or column at a fractional position, or even an interpolated plane at a fractional height of a 3D array, for example.

altenbach
Knight of NI

Note that a new bilinear interpolation for 2D arrays has been posted here. It performs faster.