#include <cx/Lookup.h>int cxLookupIndex(cxLookup *lut, float *loc, float *indices)
integer function cxLookupIndex(lut, loc, indices) integer lut real loc(*) real indices(*)
The index space coordinates of a lattice are the zero-based array indices of the lattice's data array. For instance, a lattice of size 10 by 20 would have x indices ranging from 0 to 9 and y indices ranging from 0 to 19. On this lattice, cxLookupIndex would return floating point fractional indices within these ranges. The index space coordinates indicate the point in the lattice whose interpolated coordinates would equal loc.
The sizes of loc and indices must be loc[nCoordVar] and indices[nDim], where nCoordVar and nDim are the number of coordinate variables and number of dimensions for the lattice referenced by the lookup table, respectively.
The action of cxLookupIndex is comparable to the first two steps of cxLookupInterp, finding the integer indices of the lattice cell that contains the point loc, and calculating the fractional indices of the coordinate point within the cell. The cell number yields the integer part of indices and the fractional cell indices yield the fractional part of indices.
This function returns zero to indicate success and one if a domain error is encountered, meaning that the sample point was outside the coordinate space of the lattice. For domains errors in uniform and perimeter lattices, the sample point is clamped to the domain. For domains errors in curvilinear lattices, the returned indicess are set to negative one.