Changeset 25721
- Timestamp:
- Oct 1, 2009, 12:07:54 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/20090715/Ohana/src/opihi/dvo/imbox.c
r21065 r25721 3 3 int imbox (int argc, char **argv) { 4 4 5 int j, kapa, Nskip, status, InPic, flipped, N, haveNx, haveNy, Nx, Ny, SOLO_PHU ;5 int j, kapa, Nskip, status, InPic, flipped, N, haveNx, haveNy, Nx, Ny, SOLO_PHU, Npts, NPTS; 6 6 Vector Xvec, Yvec; 7 7 double r, d, x[4], y[4], Rmin, Rmax, Rmid; … … 36 36 37 37 /* project this image to screen display coords */ 38 SetVector (&Xvec, OPIHI_FLT, 8); 39 SetVector (&Yvec, OPIHI_FLT, 8); 38 Npts = 0; 39 NPTS = 200; 40 SetVector (&Xvec, OPIHI_FLT, NPTS); 41 SetVector (&Yvec, OPIHI_FLT, NPTS); 40 42 41 43 while (gfits_fread_header (f, &header)) { … … 82 84 while (r > Rmid) r-= 360.0; 83 85 } 84 status |= RD_to_XY (&Xvec.elements.Flt[ 2*j], &Yvec.elements.Flt[2*j], r, d, &graphmode.coords);86 status |= RD_to_XY (&Xvec.elements.Flt[Npts + 2*j], &Yvec.elements.Flt[Npts + 2*j], r, d, &graphmode.coords); 85 87 if (j > 0) { 86 Xvec.elements.Flt[ 2*j - 1] = Xvec.elements.Flt[2*j];87 Yvec.elements.Flt[ 2*j - 1] = Yvec.elements.Flt[2*j];88 Xvec.elements.Flt[Npts + 2*j - 1] = Xvec.elements.Flt[Npts + 2*j]; 89 Yvec.elements.Flt[Npts + 2*j - 1] = Yvec.elements.Flt[Npts + 2*j]; 88 90 } 89 91 } 90 Xvec.elements.Flt[7] = Xvec.elements.Flt[0]; 91 Yvec.elements.Flt[7] = Yvec.elements.Flt[0]; 92 Xvec.elements.Flt[Npts + 7] = Xvec.elements.Flt[Npts + 0]; 93 Yvec.elements.Flt[Npts + 7] = Yvec.elements.Flt[Npts + 0]; 94 92 95 InPic = FALSE; 93 96 for (j = 0; j < 8; j+=2) { 94 if ((Xvec.elements.Flt[j] >= graphmode.xmin) && 95 (Xvec.elements.Flt[j] <= graphmode.xmax) && 96 (Yvec.elements.Flt[j] >= graphmode.ymin) && 97 (Yvec.elements.Flt[j] <= graphmode.ymax)) 98 InPic = TRUE; 97 if ((Xvec.elements.Flt[Npts + j] >= graphmode.xmin) && 98 (Xvec.elements.Flt[Npts + j] <= graphmode.xmax) && 99 (Yvec.elements.Flt[Npts + j] >= graphmode.ymin) && 100 (Yvec.elements.Flt[Npts + j] <= graphmode.ymax)) 101 InPic = TRUE; 102 } 103 if (!InPic) continue; 104 105 Npts += 8; 106 if (Npts + 8 >= NPTS) { /* need to leave room for 4 point image */ 107 NPTS += 200; 108 REALLOCATE (Xvec.elements.Flt, opihi_flt, NPTS); 109 REALLOCATE (Yvec.elements.Flt, opihi_flt, NPTS); 99 110 } 100 111 101 Xvec.Nelements = Yvec.Nelements = 8;102 if (InPic) {103 graphmode.style = 2; /* points */104 graphmode.ptype = 100; /* connect pairs of points */105 graphmode.etype = 0;106 PlotVectorPair (kapa, &Xvec, &Yvec, &graphmode);107 }108 112 skip: 109 113 Nskip = gfits_data_size (&header); … … 111 115 gfits_free_header (&header); 112 116 } 117 118 Xvec.Nelements = Yvec.Nelements = Npts; 119 if (Npts > 0) { 120 graphmode.style = 2; /* points */ 121 graphmode.ptype = 100; /* connect pairs of points */ 122 graphmode.etype = 0; 123 PlotVectorPair (kapa, &Xvec, &Yvec, &graphmode); 124 } 125 113 126 fclose (f); 114 127 free (Xvec.elements.Flt);
Note:
See TracChangeset
for help on using the changeset viewer.
