Changeset 42942 for trunk/Ohana/src/opihi/cmd.astro/cgrid.c
- Timestamp:
- Nov 12, 2025, 5:00:47 PM (8 months ago)
- File:
-
- 1 edited
-
trunk/Ohana/src/opihi/cmd.astro/cgrid.c (modified) (9 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Ohana/src/opihi/cmd.astro/cgrid.c
r41515 r42942 12 12 # define ADD_COORDINATE(RA,DEC) \ 13 13 status = RD_to_XY (&Xvec.elements.Flt[N], &Yvec.elements.Flt[N], (RA), (DEC), &graphmode.coords); \ 14 if ((Xvec.elements.Flt[N] >= graphmode.xmin) && (Xvec.elements.Flt[N] <= graphmode.xmax) && \15 (Yvec.elements.Flt[N] >= graphmode.ymin) && (Yvec.elements.Flt[N] <= graphmode.ymax) && status) { \14 if ((Xvec.elements.Flt[N] >= Xmin) && (Xvec.elements.Flt[N] <= Xmax) && \ 15 (Yvec.elements.Flt[N] >= Ymin) && (Yvec.elements.Flt[N] <= Ymax) && status) { \ 16 16 N++; \ 17 17 CHECKELEMENTS; \ … … 154 154 if (!style_args (&graphmode, &argc, argv, &kapa)) return FALSE; 155 155 156 // we need to rationalize graphmode.xmin,xmax (can be flipped) 157 int Xmin = MIN(graphmode.xmin,graphmode.xmax); 158 int Xmax = MAX(graphmode.xmin,graphmode.xmax); 159 int Ymin = MIN(graphmode.ymin,graphmode.ymax); 160 int Ymax = MAX(graphmode.ymin,graphmode.ymax); 161 156 162 if (argc != 1) goto usage; 157 163 … … 159 165 NorthPole = SouthPole = FALSE; 160 166 status = RD_to_XY (&x, &y, 0.0, 90.0, &graphmode.coords); 161 if ((x >= graphmode.xmin) && (x <= graphmode.xmax) && 162 (y >= graphmode.ymin) && (y <= graphmode.ymax) && status) 167 // if the parity is flipped in either direction, xmin > xmax or ymin > ymax 168 if ((x >= Xmin) && (x <= Xmax) && 169 (y >= Ymin) && (y <= Ymax) && status) 163 170 NorthPole = TRUE; 164 171 status = RD_to_XY (&x, &y, 0.0, -90.0, &graphmode.coords); 165 if ((x >= graphmode.xmin) && (x <= graphmode.xmax) &&166 (y >= graphmode.ymin) && (y <= graphmode.ymax) && status)172 if ((x >= Xmin) && (x <= Xmax) && 173 (y >= Ymin) && (y <= Ymax) && status) 167 174 SouthPole = TRUE; 168 175 … … 173 180 if (mode == PROJ_MODE_PSEUDOCYL) { 174 181 // for PSEUDOCYL, the ra range is 360 if the corners are invalid 175 InvalidCorner |= XY_to_RD (&r, &d, graphmode.xmin, graphmode.ymin, &graphmode.coords);176 InvalidCorner |= XY_to_RD (&r, &d, graphmode.xmax, graphmode.ymin, &graphmode.coords);177 InvalidCorner |= XY_to_RD (&r, &d, graphmode.xmax, graphmode.ymax, &graphmode.coords);178 InvalidCorner |= XY_to_RD (&r, &d, graphmode.xmin, graphmode.ymax, &graphmode.coords);182 InvalidCorner |= XY_to_RD (&r, &d, Xmin, Ymin, &graphmode.coords); 183 InvalidCorner |= XY_to_RD (&r, &d, Xmax, Ymin, &graphmode.coords); 184 InvalidCorner |= XY_to_RD (&r, &d, Xmax, Ymax, &graphmode.coords); 185 InvalidCorner |= XY_to_RD (&r, &d, Xmin, Ymax, &graphmode.coords); 179 186 } 180 187 181 range = MIN (fabs(graphmode.coords.cdelt1*( graphmode.xmax-graphmode.xmin)), fabs(graphmode.coords.cdelt2*(graphmode.ymax-graphmode.ymin)));188 range = MIN (fabs(graphmode.coords.cdelt1*(Xmax-Xmin)), fabs(graphmode.coords.cdelt2*(Ymax-Ymin))); 182 189 if (NorthPole || SouthPole || InvalidCorner) range = 360; 183 190 dR = range * GRID_SPACING; … … 266 273 char line[16], format[16]; 267 274 double xt, yt, frac; 268 // dx = +0.01 * ( graphmode.xmax - graphmode.xmin);269 // dy = -0.02 * ( graphmode.ymax - graphmode.ymin);275 // dx = +0.01 * (Xmax - Xmin); 276 // dy = -0.02 * (Ymax - Ymin); 270 277 271 278 if (isnan(LabelRA)) LabelRA = graphmode.coords.crval1; … … 274 281 status = RD_to_XY (&xt, &yt, r, LabelDEC, &graphmode.coords); 275 282 if (!status) continue; 276 if (xt < graphmode.xmin) continue;277 if (xt > graphmode.xmax) continue;278 if (yt < graphmode.ymin) continue;279 if (yt > graphmode.ymax) continue;283 if (xt < Xmin) continue; 284 if (xt > Xmax) continue; 285 if (yt < Ymin) continue; 286 if (yt > Ymax) continue; 280 287 frac = -1.0 * log10(minorRA); 281 288 if (frac != (int)frac) { … … 295 302 status = RD_to_XY (&xt, &yt, r, LabelDEC, &graphmode.coords); 296 303 if (!status) continue; 297 if (xt < graphmode.xmin) continue;298 if (xt > graphmode.xmax) continue;299 if (yt < graphmode.ymin) continue;300 if (yt > graphmode.ymax) continue;304 if (xt < Xmin) continue; 305 if (xt > Xmax) continue; 306 if (yt < Ymin) continue; 307 if (yt > Ymax) continue; 301 308 frac = -1.0 * log10(minorRA); 302 309 if (frac != (int)frac) { … … 316 323 status = RD_to_XY (&xt, &yt, LabelRA, d, &graphmode.coords); 317 324 if (!status) continue; 318 if (xt < graphmode.xmin) continue;319 if (xt > graphmode.xmax) continue;320 if (yt < graphmode.ymin) continue;321 if (yt > graphmode.ymax) continue;325 if (xt < Xmin) continue; 326 if (xt > Xmax) continue; 327 if (yt < Ymin) continue; 328 if (yt > Ymax) continue; 322 329 frac = -1.0 * log10(minorDEC); 323 330 if (frac != (int)frac) { … … 332 339 status = RD_to_XY (&xt, &yt, LabelRA, d, &graphmode.coords); 333 340 if (!status) continue; 334 if (xt < graphmode.xmin) continue;335 if (xt > graphmode.xmax) continue;336 if (yt < graphmode.ymin) continue;337 if (yt > graphmode.ymax) continue;341 if (xt < Xmin) continue; 342 if (xt > Xmax) continue; 343 if (yt < Ymin) continue; 344 if (yt > Ymax) continue; 338 345 frac = -1.0 * log10(minorDEC); 339 346 if (frac != (int)frac) {
Note:
See TracChangeset
for help on using the changeset viewer.
