Name
- WVextension - interface definition for data array extension
Synopsis
-
typedef WVdata (*WVextension)(const WVdata *dataArr, WVdimension length,
WVdimension index, wvBool isNegative);
Inputs
| dataArr | array of data values |
| length | number of elements in dataArr |
| index | absolute value of index of element |
| isNegative | flag if index is negative |
Returns
The value of the element at the specified index, even if index is negative
or greater than the actual size of the array.
Description
-
WVextension is a procedure which allows a finite array to be treated
as an infinite array. Accessing elements of the array is accomplished
by calls to WVextension instead of using the normal (square-bracket)
array indexing operator.
The library defines two extension methods: wvSymmetricEvenExt and
wvSymmetricOddExt. This pair of extensions produces good results for
images and other smooth data. If these extensions are not suitable or
satisfactory, the applications programmer is free to write custom extension
procedures (see the example, below, for some simple extension methods).
Example
-
#include <wv/wv.h>
.
.
.
WVdata ZeroExt(const WVdata *dataArr, WVdimension length,
WVdimension index, wvBool isNegative)
{
if(isNegative || i >= length) return 0;
else return dataArr[i];
}
WVdata PeriodicExt(const WVdata *dataArr,
WVdimension length, WVdimension index,
wvBool isNegative)
{
i %= length;
if(isNegative) i = length-i;
return dataArr[i];
}
See Also
-
wvBuildBasis(3)
|