ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/common/interp2d.h
(Generate patch)

Comparing ray/src/common/interp2d.h (file contents):
Revision 2.4 by greg, Mon Feb 11 22:56:22 2013 UTC vs.
Revision 2.10 by greg, Sat Feb 13 16:49:18 2021 UTC

# Line 15 | Line 15 | extern "C" {
15   #define NI2DSMF 0.42f                   /* minimal smoothing factor */
16  
17   #define NI2DIR  (2*4)                   /* # interpolation directions */
18 + #define NI2DIM  16                      /* size of influence map */
19  
20   /* Data structure for interpolant */
21   typedef struct {
22          int             ns;             /* number of sample positions */
23          float           dmin;           /* minimum diameter (default=1) */
24          float           smf;            /* smoothing factor (def=NI2DSMF) */
25 <        unsigned short  (*da)[NI2DIR];  /* anisotropic distances (private) */
25 >        float           smin[2];        /* sample minima */
26 >        float           smax[2];        /* sample maxima */
27 >        float           grid2;          /* grid diameter squared */
28 >        void            *c_data;        /* client data pointer */
29 >        struct interp2_samp {
30 >                unsigned short  dia[NI2DIR];
31 >                unsigned short  infl[NI2DIM];
32 >        }               *da;            /* direction array (private) */
33          float           spt[1][2];      /* sample positions (extends struct) */
34   } INTERP2;
35  
# Line 31 | Line 39 | extern INTERP2 *interp2_alloc(int nsamps);
39   /* Resize interpolation array (caller must assign any new values) */
40   extern INTERP2  *interp2_realloc(INTERP2 *ip, int nsamps);
41  
42 + /* Set minimum distance under which samples will start to merge */
43 + extern void     interp2_spacing(INTERP2 *ip, double mind);
44 +
45 + /* Modify smoothing parameter by the given factor */
46 + extern void     interp2_smooth(INTERP2 *ip, double sf);
47 +
48   /* Assign full set of normalized weights to interpolate the given location */
49   extern int      interp2_weights(float wtv[], INTERP2 *ip, double x, double y);
50  
# Line 43 | Line 57 | extern void    interp2_free(INTERP2 *ip);
57   /* (Re)compute anisotropic basis function interpolant (normally automatic) */
58   extern int      interp2_analyze(INTERP2 *ip);
59  
60 + /* Compute unnormalized weight for a position relative to a sample */
61 + double          interp2_wti(INTERP2 *ip, const int i, double x, double y);
62 +
63   /***************************************************************
64   * Typical use is to allocate an INTERP2 struct and assign the
65   * spt[] array with the ordered sample locations in x & y.  (The
# Line 52 | Line 69 | extern int     interp2_analyze(INTERP2 *ip);
69   * vector for all the samples, or interp2_topsamp() is called to
70   * get the most important N samples for the specified location.
71   * The weights (and indexes in the case of interp2_topsamp)
72 < * are then used as coefficients for corresponding sample values
73 < * in a vector sum together that interpolates the function at that
74 < * location.  Between the initial allocation call and the first
75 < * weight evaluation, the dmin member may be adjusted to
76 < * the distance under which samples will start to merge.  If this
77 < * parameter is later changed, interp2_analyze() should be called
78 < * to recompute the interpolant.
79 < * The smf member sets the smoothing factor for interpolation.
80 < * The default setting of NI2DSMF produces near-optimal
81 < * interpolation when well-separated sample values are known
82 < * precisely.  If a greater degree of mixing is desired, this
83 < * paremter may be increased and it will affect the next call
84 < * to interp2_weights() or interp2_topsamp().
72 > * are then used as coefficients for corresponding sample
73 > * values in a vector sum that interpolates the function at
74 > * that location.
75 > * The minimum distance between sample positions defaults to 1.0.
76 > * Values spaced closer than this will be merged/averaged.
77 > * The interp2_spacing() call may be used to alter this distance,
78 > * causing the interpolant to be recalculated during the
79 > * next call to the sampling functions.
80 > * The default smoothing factor NI2DSMF provides near-optimal
81 > * interpolation when well-separated values are known
82 > * precisely.  Increase this setting by a factor > 1
83 > * with the interp2_smooth() call if greater mixing is desired.
84 > * A call of interp2_smooth(ip,0) resets to the minimum
85 > * default.  It is not possible to "sharpen" the data.
86   **************************************************************/
87  
88   #ifdef __cplusplus

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines