Changeset 41164 for trunk/Ohana/src/opihi/cmd.data/interpolate_presort.c
- Timestamp:
- Nov 27, 2019, 11:22:02 AM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Ohana/src/opihi/cmd.data/interpolate_presort.c
r40007 r41164 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 } 9 16 10 17 /** check basic syntax **/ … … 36 43 y0 = yin[0].elements.Flt[0]; 37 44 38 /* in and out vectors are sorted */ 39 j = 0; 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 } 40 49 41 50 // every output pixel should get a value unless 42 51 // we are below the lowest in or above the highest in 43 for ( i = 0,j = 0; (i < xout[0].Nelements) && (j < xin[0].Nelements - 1); ) {52 for (j = 0; (i < xout[0].Nelements) && (j < xin[0].Nelements - 1); ) { 44 53 45 54 yout[0].elements.Flt[i] = NAN; … … 66 75 67 76 // fill in the rest with NANs 77 int NinLast = xin[0].Nelements - 1; 68 78 while (i < yout[0].Nelements) { 69 yout[0].elements.Flt[i] = NAN;79 yout[0].elements.Flt[i] = FillEnds ? yin[0].elements.Flt[NinLast] : NAN; 70 80 i++; 71 81 } 72 82 73 83 return (TRUE); 74 75 84 }
Note:
See TracChangeset
for help on using the changeset viewer.
