Changeset 7079
- Timestamp:
- May 5, 2006, 5:34:21 PM (20 years ago)
- File:
-
- 1 edited
-
trunk/psLib/src/astro/psCoord.c (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/src/astro/psCoord.c
r6484 r7079 10 10 * @author GLG, MHPCC 11 11 * 12 * @version $Revision: 1.11 8$ $Name: not supported by cvs2svn $13 * @date $Date: 2006-0 2-24 23:43:15$12 * @version $Revision: 1.119 $ $Name: not supported by cvs2svn $ 13 * @date $Date: 2006-05-06 03:34:21 $ 14 14 * 15 15 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 32 32 #include <float.h> 33 33 34 # define ELIXIR_CODE 1 34 35 35 36 static void planeFree(psPlane *p) … … 375 376 cosDelta = cos(coord->d); 376 377 378 # if ELIXIR_CODE 379 380 sinTheta = cosDelta*cosAlpha*cosDp + sinDelta*sinDp; 381 sinPhiCT = cosDelta*sinAlpha; 382 cosPhiCT = cosDelta*cosAlpha*sinDp - sinDelta*cosDp; 383 # else 384 377 385 sinTheta = sinDelta*sinDp + cosDelta*cosDp*cosAlpha; 378 cosPhiCT = sinDelta*cosDp - cosDelta*sinDp*cosAlpha; 379 sinPhiCT = -cosDelta*sinAlpha; 380 } else { 381 phi = coord->r - projection->R; 382 theta = coord->d - projection->D; 383 } 384 385 // Perform the specified projection 386 switch (projection->type) { 386 cosPhiCT = sinDelta*cosDp - cosDelta*sinDp*cosAlpha; 387 sinPhiCT = -cosDelta*sinAlpha; 388 # endif 389 390 } else { 391 phi = coord->r - projection->R; 392 theta = coord->d - projection->D; 393 } 394 395 // Perform the specified projection 396 switch (projection->type) { 387 397 case PS_PROJ_TAN: 388 398 // Gnomonic projection … … 468 478 case PS_PROJ_TAN: 469 479 // Gnonomic deprojection 480 // the MHPCC version here was fine 481 # if 0 482 483 sinPhi = (R == 0) ? 0.0 : +x / R; 484 cosPhi = (R == 0) ? 1.0 : -y / R; 470 485 rho = sqrt (1 + R*R); 486 sinTheta = 1 / rho; 487 cosTheta = R / rho; 488 # else 489 490 rho = sqrt (1 + R*R); 471 491 sinTheta = 1 / rho; 472 492 cosTheta = R / rho; 473 493 sinPhi = (R == 0) ? 0.0 : +x / R; 474 494 cosPhi = (R == 0) ? 1.0 : -y / R; 495 # endif 496 475 497 break; 476 498 case PS_PROJ_SIN: … … 508 530 509 531 // Convert from projection spherical coordinates 510 psF64 delta = asin(sinTheta*sinDp + cosTheta*cosDp*cosPhi); 511 psF64 sinAlphaF = -cosTheta*sinPhi; 512 psF64 cosAlphaF = -cosTheta*cosPhi*sinDp + sinTheta*cosDp; 532 // psLib versions: 533 # if ELIXIR_CODE 534 // XXX the elixir version : does the ADD have a sign error 535 psF64 delta = asin(sinTheta*sinDp - cosTheta*cosPhi*cosDp); 536 psF64 sinAlpha = cosTheta*sinPhi; 537 psF64 cosAlpha = sinTheta*cosDp + cosTheta*cosPhi*sinDp; 538 # else 539 540 psF64 delta = asin(sinTheta*sinDp + cosTheta*cosDp*cosPhi); 541 psF64 sinAlpha = -cosTheta*sinPhi; 542 psF64 cosAlpha = -cosTheta*cosPhi*sinDp + sinTheta*cosDp; 543 # endif 513 544 514 545 out->d = delta; 515 out->r = atan2(sinAlpha F, cosAlphaF) + projection->R;546 out->r = atan2(sinAlpha, cosAlpha) + projection->R; 516 547 } else { 517 548 out->r = phi + projection->R;
Note:
See TracChangeset
for help on using the changeset viewer.
