Changeset 1530
- Timestamp:
- Aug 13, 2004, 12:41:24 PM (22 years ago)
- Location:
- trunk/psLib/src/astronomy
- Files:
-
- 2 edited
-
psAstrometry.c (modified) (17 diffs)
-
psAstrometry.h (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/src/astronomy/psAstrometry.c
r1519 r1530 8 8 * @author George Gusciora, MHPCC 9 9 * 10 * @version $Revision: 1.2 3$ $Name: not supported by cvs2svn $11 * @date $Date: 2004-08-13 00:01:57$10 * @version $Revision: 1.24 $ $Name: not supported by cvs2svn $ 11 * @date $Date: 2004-08-13 22:41:24 $ 12 12 * 13 13 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 97 97 } 98 98 99 psCell* psCellInFPA(psCell* outCell, 100 const psPlane* fpaCoord, 99 psCell* psCellInFPA(const psPlane* fpaCoord, 101 100 const psFPA* FPA) 102 101 { 103 102 psChip* tmpChip = NULL; 104 103 psPlane* chipCoord = NULL; 104 psCell* outCell = NULL; 105 105 106 106 if (fpaCoord == NULL) { … … 112 112 113 113 // Determine which chip contains the fpaCoords. 114 tmpChip = psChipInFPA( tmpChip,fpaCoord, FPA);114 tmpChip = psChipInFPA(fpaCoord, FPA); 115 115 116 116 // Convert to those chip coordinates. … … 118 118 119 119 // Determine which cell contains those chip coordinates. 120 outCell = psCellInChip( outCell,chipCoord, tmpChip);120 outCell = psCellInChip(chipCoord, tmpChip); 121 121 122 122 psFree(tmpChip); … … 144 144 } 145 145 146 /***************************************************************************** 147 XXX: Should we return the result in "out"? 148 *****************************************************************************/ 149 psChip* psChipInFPA(psChip* out, 150 const psPlane* fpaCoord, 146 psChip* psChipInFPA(const psPlane* fpaCoord, 151 147 const psFPA* FPA) 152 148 { … … 172 168 fpaCoord); 173 169 174 tmpCell = psCellInChip( tmpCell,chipCoord, tmpChip);170 tmpCell = psCellInChip(chipCoord, tmpChip); 175 171 if (tmpCell != NULL) { 176 172 psFree(chipCoord); … … 183 179 } 184 180 185 /***************************************************************************** 186 XXX: Should we return the result in "out"? 187 *****************************************************************************/ 188 psCell* psCellInChip(psCell* outCell, 189 const psPlane* chipCoord, 181 psCell* psCellInChip(const psPlane* chipCoord, 190 182 const psChip* chip) 191 183 { … … 277 269 278 270 return(psPlaneDistortApply(outCoord, fpa->toTangentPlane, inCoord, 279 magnitude, color));271 color, magnitude)); 280 272 } 281 273 … … 344 336 // Convert the FPA coordinates to tangent plane Coordinates. 345 337 tpCoord = psPlaneDistortApply(tpCoord, parFPA->toTangentPlane, 346 fpaCoord, magnitude, color);338 fpaCoord, color, magnitude); 347 339 348 340 // Generate a grommit for this FPA. … … 359 351 } 360 352 361 /*****************************************************************************362 XXX: After I deproject the tangent plane to a sphere, do I have to do a363 spherical transformation to get it to the sky?364 *****************************************************************************/365 353 psSphere* psCoordCellToSkyQuick(psSphere* outSphere, 366 354 const psPlane* cellCoord, … … 437 425 438 426 return (psPlaneDistortApply(fpaCoord, fpa->fromTangentPlane, 439 tpCoord, magnitude, color));427 tpCoord, color, magnitude)); 440 428 } 441 429 … … 456 444 } 457 445 458 psChip *newChip = psChipInFPA(newChip, fpaCoord, FPA); 446 // Determine which chip contains these FPA coordinates. 447 psChip *newChip = psChipInFPA(fpaCoord, FPA); 459 448 if (newChip == NULL) { 460 449 return(NULL); … … 482 471 } 483 472 484 psCell *newCell = psCellInChip(newCell, chipCoord, chip); 473 // Determine which cell contains these FPA coordinates. 474 psCell *newCell = psCellInChip(chipCoord, chip); 485 475 if (newCell == NULL) { 486 476 return(NULL); … … 492 482 } 493 483 484 /***************************************************************************** 485 XXX: Should we do anything to determine which cell contains the coordinates? 486 *****************************************************************************/ 494 487 psPlane* psCoordSkyToCell(psPlane* cellCoord, 495 488 const psSphere* skyCoord, … … 570 563 simply inverts the supplied psPlaneTransform transform. It assumes that 571 564 "transform" is linear. 565 566 This program assumes that the inverse of the following linear equations: 567 X2 = A + (B * X1) + (C * Y1); 568 Y2 = D + (E * X1) + (F * Y1); 569 is 570 Y1 = (Y2 - ((E/B) * X2) - D + ((E*A)/B)) / (F - ((C*E)/B)); 571 X1 = (Y2 - ((F/C) * X2) - D + ((F*A)/C)) / (E - ((F*B)/C)); 572 or 573 X1 = (-D + ((F*A)/C)) / (E - ((F*B)/C)) + 574 (X2 * -((F/C) / (E - ((F*B)/C)))) + 575 (Y2 * (1.0 / (E - ((F*B)/C)))); 576 Y1 = (-D + ((E*A)/B))/(F - ((C*E)/B)) + 577 (X2 * -((E/B) / (F - ((C*E)/B)))) + 578 (Y2 * (1.0 / (F - ((C*E)/B)))); 572 579 *****************************************************************************/ 573 psPlaneTransform *p_psInvertPlaneDistortTransform(psPlaneTransform *transform) 574 { 580 psPlaneTransform *p_psInvertPlaneTransform(psPlaneTransform *transform) 581 { 582 double A = transform->x->coeff[0][0]; 583 double B = transform->x->coeff[1][0]; 584 double C = transform->x->coeff[0][1]; 585 double D = transform->y->coeff[0][0]; 586 double E = transform->y->coeff[1][0]; 587 double F = transform->y->coeff[0][1]; 588 575 589 if (transform == NULL) { 576 590 psAbort(__func__, "input parameter transform is NULL."); … … 578 592 psPlaneTransform *out = psAlloc(sizeof(psPlaneTransform)); 579 593 580 // XXX: figure it out 594 out->x->coeff[0][0] = -D + ((F*A)/C) / (E - ((F*B)/C)); 595 out->x->coeff[1][0] = -(F/C) / (E - ((F*B)/C)); 596 out->x->coeff[0][1] = 1.0 / (E - ((F*B)/C)); 597 out->y->coeff[0][0] = -D + ((E*A)/B) / (F - ((C*E)/B)); 598 out->y->coeff[1][0] = -(E/B) / (F - ((C*E)/B)); 599 out->y->coeff[0][1] = 1.0 / (F - ((C*E)/B)); 600 581 601 return(out); 582 602 } 583 603 604 /***************************************************************************** 605 XXX: Should we do anything to determine which cell contains the coordinates? 606 *****************************************************************************/ 584 607 psPlane* psCoordSkyToCellQuick(psPlane* cellCoord, 585 608 const psSphere* skyCoord, … … 614 637 } 615 638 616 TPtoCell = p_psInvertPlane DistortTransform(cell->toTP);639 TPtoCell = p_psInvertPlaneTransform(cell->toTP); 617 640 cellCoord = psPlaneTransformApply(cellCoord, TPtoCell, tpCoord); 618 641 -
trunk/psLib/src/astronomy/psAstrometry.h
r1514 r1530 8 8 * @author George Gusciora, MHPCC 9 9 * 10 * @version $Revision: 1.2 1$ $Name: not supported by cvs2svn $11 * @date $Date: 2004-08-1 2 05:36:53$10 * @version $Revision: 1.22 $ $Name: not supported by cvs2svn $ 11 * @date $Date: 2004-08-13 22:41:24 $ 12 12 * 13 13 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 258 258 */ 259 259 psCell* psCellInFPA( 260 psCell* out, ///< a cell struct to recycle. If NULL, a new struct is created261 260 const psPlane* coord, ///< the coordinate in FPA plane 262 261 const psFPA* FPA ///< the FPA to search for the cell … … 268 267 */ 269 268 psChip* psChipInFPA( 270 psChip* out, ///< a chip struct to recycle. If NULL, a new struct is created271 269 const psPlane* coord, ///< the coordinate in FPA plane 272 270 const psFPA* FPA ///< the FPA to search for the cell … … 278 276 */ 279 277 psCell* psCellInChip( 280 psCell* out, ///< a cell struct to recycle. If NULL, a new struct is created281 278 const psPlane* coord, ///< the coordinate in Chip plane 282 279 const psChip* chip ///< the chip to search for the cell
Note:
See TracChangeset
for help on using the changeset viewer.
