These functions perform linear interpolation of a field. The field is specified at M+1 points in N-D space. (The M+1 points form an M-D simplex. If M = N, then there is a unique linear function that is is equal to the specified field values. (For M = N = 1, two points with field values determine the equation of a line.) If M < N, then the linear function is not uniquely determined from the specified points and field values. In this case, we add the constraint that the interpolating function is constant in directions normal to the simplex. (For M = 1 and N = 2 the function is constrained to be constant in the direction orthogonal to the supporting line of the two points.)
These functions are used in the geom::IndexedSimplexSet_Interpolation class.
Note that the functions avoid constructing field objects by taking constant references as arguments and returning constant references to static field objects. This is because the field object might be expensive to construct. (For instance it might be an ads::FixedArray<P,double>
.)
The general interface is:
numerical::linear_interpolation(const ads::FixedArray<M+1,ads::FixedArray<N,T>>& positions,const ads::FixedArray<M+1,F>& values,const ads::FixedArray<N,T>& location).
There are also interfaces that are specialized for specific dimensions.