ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/Development/ray/src/common/data.c
(Generate patch)

Comparing ray/src/common/data.c (file contents):
Revision 2.1 by greg, Fri Aug 2 18:47:25 2024 UTC vs.
Revision 2.5 by greg, Sat Jun 7 05:09:45 2025 UTC

# Line 10 | Line 10 | static const char      RCSid[] = "$Id$";
10   #include  <time.h>
11  
12   #include  "platform.h"
13 #include  "paths.h"
13   #include  "standard.h"
14   #include  "color.h"
15   #include  "view.h"
# Line 343 | Line 342 | getspec(               /* load hyperspectral image as data */
342   #endif
343          if ((pp->arr.s = (uby8 *)malloc(i)) == NULL)
344                  goto memerr;
345 <        for (y = 0; y < ns; y++)                /* read each scanline */
345 >        for (y = ns; y-- > 0; )                 /* read each scanline */
346                  if (freadscolrs(pp->arr.s + y*sl*(si.nc+1), si.nc, sl, fp) < 0)
347                          goto readerr;
348          fclose(fp);
# Line 462 | Line 461 | data_interp(DATARRAY *dp, double *pt, double coef, DAT
461                  c0 = 1./(i-1 - x);
462                  c1 = -2.*c0;
463          } else if (x < i-1) {
464 <                c1 = 1./(i - x);
464 >                c1 = 1./(x - i);
465                  c0 = -2.*c1;
466          } else {
467                  c0 = i+1 - x;
# Line 481 | Line 480 | data_interp(DATARRAY *dp, double *pt, double coef, DAT
480                          double  f;
481                          sd.arr.s = dp->arr.s + i*stride;
482                          if ((sd.arr.s[sd.dim[0].ne] > 0) & ((-FTINY>c0)|(c0>FTINY))) {
483 <                                f = ldexp(c0, (int)sd.arr.s[sd.dim[0].ne]-(COLXS+8));
483 >                                f = c0 * cxponent[sd.arr.s[sd.dim[0].ne]];
484                                  for (i = sd.dim[0].ne; i--; )
485                                          rvec[i] += f*(sd.arr.s[i] + .5);
486                          }
487                          sd.arr.s += stride;
488                          if ((sd.arr.s[sd.dim[0].ne] > 0) & ((-FTINY>c1)|(c1>FTINY))) {
489 <                                f = ldexp(c1, (int)sd.arr.s[sd.dim[0].ne]-(COLXS+8));
489 >                                f = c1 * cxponent[sd.arr.s[sd.dim[0].ne]];
490                                  for (i = sd.dim[0].ne; i--; )
491                                          rvec[i] += f*(sd.arr.s[i] + .5);
492                          }
# Line 520 | Line 519 | data_interp(DATARRAY *dp, double *pt, double coef, DAT
519                          y0 = dp->arr.d[i];
520                          y1 = dp->arr.d[i+1];
521                  } else if (dp->type == SPECTY) {
522 <                        if (dp->arr.s[dp->dim[0].ne]) {
523 <                                double  f = dp->arr.s[dp->dim[0].ne]
524 <                                        ? ldexp(1., -(COLXS+8) +
526 <                                                (int)dp->arr.s[dp->dim[0].ne])
527 <                                        : 0.;
528 <                                y0 = f*(dp->arr.s[i] + 0.5);
529 <                                y1 = f*(dp->arr.s[i+1] + 0.5);
530 <                        } else
531 <                                y0 = y1 = 0.;
522 >                        double  f = cxponent[dp->arr.s[dp->dim[0].ne]];
523 >                        y0 = f*(dp->arr.s[i] + 0.5);
524 >                        y1 = f*(dp->arr.s[i+1] + 0.5);
525                  } else {
526                          y0 = colrval(dp->arr.c[i],dp->type);
527                          y1 = colrval(dp->arr.c[i+1],dp->type);

Diff Legend

Removed lines
+ Added lines
< Changed lines (old)
> Changed lines (new)