Hi all,
I have a 3d table that represents distance for a given
height angle and temperature
for example the table looks like this
For angles from 0 through 45 to 90
and height from 0 through 200 to 600
and temperature from -5 through 10 to 25
Angle |__0__|__45__|__90__
Height |Temp'|
0 | -5 |_25__|__19__|__17__
0 | 10 |_20__|__16__|__12__
0 | 25 |_27__|__32__|__30__
200 | -5 |_27__|__32__|__30__
200 | 10 |_25__|__29__|__28__
200 | 25 |_24__|__22__|__20__
600 | -5 |_40__|__47__|__50__
600 | 10 |_38__|__42__|__46__
600 | 25 |_37__|__39__|__40__
for angle =45, height = 200 and temperature = -5 the value is 32
I want a c++ function that receives an angle height and temperature and
return the interpolated value of the distance
float GetInerpolatedVal(int angle,int Height, int temperature );
the call will look like this
float fVal = GetInerpolatedVal(24,343,-2)
I guess I need to use some kind of 3d interpolation but I cant seem to find
an implementation that works with a table such as this.
I Found a 3d interpolation that seems like this:
double Linear3dInterp(double v1, double v2, double v3, double v4,
double v5, double v6, double v7, double v8, x, y, z );
But i dont understand what are v1-v8 (i guess x y and z are a given height angle and temperature for my example)
Thanks!
What I have tried:
Googling 3d interpolation
Using 1d interpolation as a base for 2d interpolation
and then Using 2d interpolation as a base for 3d interpolation
but i got confused with which values are the boundaries for the 2d interpolation