Changeset 41340 for trunk/Ohana/src/opihi/cmd.data/interpolate_presort.c
- Timestamp:
- Apr 16, 2020, 1:54:47 PM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Ohana/src/opihi/cmd.data/interpolate_presort.c
r41164 r41340 7 7 double x0, dx, dy, y0; 8 8 Vector *xout, *yout, *xin, *yin; 9 10 int N;11 int FillEnds = FALSE;12 if ((N = get_argument (argc, argv, "-fill-ends"))) {13 FillEnds = TRUE;14 remove_argument (N, &argc, argv);15 }16 9 17 10 /** check basic syntax **/ … … 43 36 y0 = yin[0].elements.Flt[0]; 44 37 45 // fill in the start with NANs 46 for (i = 0; (i < xout[0].Nelements) && (xout[0].elements.Flt[i] < xin[0].elements.Flt[0]); i++) { 47 yout[0].elements.Flt[i] = FillEnds ? yin[0].elements.Flt[0] : NAN; 48 } 38 /* in and out vectors are sorted */ 39 j = 0; 49 40 50 41 // every output pixel should get a value unless 51 42 // we are below the lowest in or above the highest in 52 for ( j = 0; (i < xout[0].Nelements) && (j < xin[0].Nelements - 1); ) {43 for (i = 0, j = 0; (i < xout[0].Nelements) && (j < xin[0].Nelements - 1); ) { 53 44 54 45 yout[0].elements.Flt[i] = NAN; … … 75 66 76 67 // fill in the rest with NANs 77 int NinLast = xin[0].Nelements - 1;78 68 while (i < yout[0].Nelements) { 79 yout[0].elements.Flt[i] = FillEnds ? yin[0].elements.Flt[NinLast] :NAN;69 yout[0].elements.Flt[i] = NAN; 80 70 i++; 81 71 } 82 72 83 73 return (TRUE); 74 84 75 }
Note:
See TracChangeset
for help on using the changeset viewer.
