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.3 by greg, Sat Feb 9 20:56:40 2013 UTC vs.
Revision 2.4 by greg, Mon Feb 11 22:56:22 2013 UTC

# Line 1 | Line 1
1   /* RCSid $Id$ */
2   /*
3 < * Header for interpolation of anisotropic values on 2-D plane.
3 > * Header for interpolation of anisotropic samples on 2-D plane.
4   *
5   *      G.Ward Feb 2013
6   */
# Line 12 | Line 12
12   extern "C" {
13   #endif
14  
15 < #define NI2DSMF 0.42f                   /* minimal smoothing radius */
15 > #define NI2DSMF 0.42f                   /* minimal smoothing factor */
16  
17   #define NI2DIR  (2*4)                   /* # interpolation directions */
18  
19   /* Data structure for interpolant */
20   typedef struct {
21          int             ns;             /* number of sample positions */
22 <        float           rmin;           /* minimum valid radius (default=.5) */
22 >        float           dmin;           /* minimum diameter (default=1) */
23          float           smf;            /* smoothing factor (def=NI2DSMF) */
24 <        unsigned short  (*ra)[NI2DIR];  /* anisotropic radii (private) */
24 >        unsigned short  (*da)[NI2DIR];  /* anisotropic distances (private) */
25          float           spt[1][2];      /* sample positions (extends struct) */
26   } INTERP2;
27  
# Line 43 | Line 43 | extern void    interp2_free(INTERP2 *ip);
43   /* (Re)compute anisotropic basis function interpolant (normally automatic) */
44   extern int      interp2_analyze(INTERP2 *ip);
45  
46 + /***************************************************************
47 + * Typical use is to allocate an INTERP2 struct and assign the
48 + * spt[] array with the ordered sample locations in x & y.  (The
49 + * actual orientation of the axes is not important so long as
50 + * the application is consistent.)  During interpolation, either
51 + * interp2_weights() is called to obtain a normalized weighting
52 + * vector for all the samples, or interp2_topsamp() is called to
53 + * get the most important N samples for the specified location.
54 + * The weights (and indexes in the case of interp2_topsamp)
55 + * are then used as coefficients for corresponding sample values
56 + * in a vector sum together that interpolates the function at that
57 + * location.  Between the initial allocation call and the first
58 + * weight evaluation, the dmin member may be adjusted to
59 + * the distance under which samples will start to merge.  If this
60 + * parameter is later changed, interp2_analyze() should be called
61 + * to recompute the interpolant.
62 + * The smf member sets the smoothing factor for interpolation.
63 + * The default setting of NI2DSMF produces near-optimal
64 + * interpolation when well-separated sample values are known
65 + * precisely.  If a greater degree of mixing is desired, this
66 + * paremter may be increased and it will affect the next call
67 + * to interp2_weights() or interp2_topsamp().
68 + **************************************************************/
69 +
70   #ifdef __cplusplus
71   }
72   #endif

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines