Changeset 5450
- Timestamp:
- Oct 27, 2005, 4:25:22 PM (21 years ago)
- Location:
- trunk/psLib
- Files:
-
- 6 edited
-
src/astro/psEarthOrientation.c (modified) (3 diffs)
-
src/astro/psEarthOrientation.h (modified) (2 diffs)
-
test/astro/tst_psEarthOrientation.c (modified) (5 diffs)
-
test/astro/tst_psSphereOps.c (modified) (7 diffs)
-
test/astro/verified/tst_psEarthOrientation.stderr (modified) (3 diffs)
-
test/astro/verified/tst_psEarthOrientation.stdout (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/src/astro/psEarthOrientation.c
r5447 r5450 9 9 * @author Robert Daniel DeSonia, MHPCC 10 10 * 11 * @version $Revision: 1. 6$ $Name: not supported by cvs2svn $12 * @date $Date: 2005-10-2 7 20:38:18$11 * @version $Revision: 1.7 $ $Name: not supported by cvs2svn $ 12 * @date $Date: 2005-10-28 02:25:22 $ 13 13 * 14 14 * Copyright 2005 Maui High Performance Computing Center, University of Hawaii … … 19 19 20 20 #include "psEarthOrientation.h" 21 #include "psTime.h"21 //#include "psTime.h" 22 22 #include "psArray.h" 23 23 #include "psPolynomial.h" … … 163 163 double speed) 164 164 { 165 166 167 return NULL; 165 PS_ASSERT_PTR_NON_NULL(apparent, NULL); 166 PS_ASSERT_PTR_NON_NULL(direction, NULL); 167 if (fabs(speed) < DBL_EPSILON) { 168 psError(PS_ERR_BAD_PARAMETER_VALUE, true, 169 "Aberration speed should not be equal to 0.\n"); 170 return NULL; 171 } 172 173 if (actual == NULL) { 174 actual = psSphereAlloc(); 175 } else { 176 actual->r = 0.0; 177 actual->d = 0.0; 178 actual->rErr = 0.0; 179 actual->dErr = 0.0; 180 } 181 psSphere *rp = psSphereAlloc(); 182 psSphere *r_p = psSphereAlloc(); 183 double mu = 0.0; 184 double mu_p = 0.0; 185 double a = 0.0; 186 187 //mu = apparent * direction; I believe this should be: 188 // mu = apparent->r * direction->r + apparent->d * direction->d; 189 psCube* directionVector = psSphereToCube(direction); 190 psCube* apparentVector = psSphereToCube(apparent); 191 mu = acos(directionVector->x*apparentVector->x + 192 directionVector->y*apparentVector->y + 193 directionVector->z*apparentVector->z); 194 195 //rp = apparent - mu * direction; 196 rp->r = apparent->r - mu * direction->r; 197 rp->d = apparent->d - mu * direction->d; 198 199 mu_p = mu + speed * ((mu * mu - 1.0) / (1.0 - speed * mu)); 200 201 //Not sure if this is right. ADD gets a scalar from division of rp (a vector) 202 psCube* rpVector = psSphereToCube(rp); 203 a = sqrt( (1.0 - mu_p * mu_p) / 204 (sqrt(rpVector->x*rpVector->x 205 + rpVector->y*rpVector->y 206 + rpVector->z*rpVector->z)) ); 207 208 //r_p = mu_p * direction + a * rp; 209 r_p->r = mu_p * direction->r + a * rp->r; 210 r_p->d = mu_p * direction->d + a * rp->d; 211 212 *actual = *r_p; 213 /* 214 psSphereRot *rot = NULL; 215 double cosR = cos(direction->r); 216 double cosD = cos(direction->d); 217 double sinR = sin(direction->r); 218 double sinD = sin(direction->d); 219 rot = psSphereRotQuat(cosR*cosD, sinR*cosD, sinD, speed); 220 221 actual = psSphereRotApply(actual, rot, apparent); 222 */ 223 psFree(rp); 224 psFree(r_p); 225 psFree(directionVector); 226 psFree(apparentVector); 227 psFree(rpVector); 228 return actual; 168 229 } 169 230 -
trunk/psLib/src/astro/psEarthOrientation.h
r5447 r5450 9 9 * @author Robert Daniel DeSonia, MHPCC 10 10 * 11 * @version $Revision: 1. 5$ $Name: not supported by cvs2svn $12 * @date $Date: 2005-10-2 7 20:38:18$11 * @version $Revision: 1.6 $ $Name: not supported by cvs2svn $ 12 * @date $Date: 2005-10-28 02:25:22 $ 13 13 * 14 14 * Copyright 2005 Maui High Performance Computing Center, University of Hawaii … … 42 42 PS_PRECESS_COMPLETE, ///< complete level of detail 43 43 PS_PRECESS_IAU2000A, ///< highest level of detail 44 } psPrecessMethod; 44 } 45 psPrecessMethod; 45 46 46 47 /** Calculates the actual position of a star, given its apparent position and the -
trunk/psLib/test/astro/tst_psEarthOrientation.c
r5447 r5450 6 6 * @author d-Rob, MHPCC 7 7 * 8 * @version $Revision: 1. 4$ $Name: not supported by cvs2svn $9 * @date $Date: 2005-10-2 7 20:38:19$8 * @version $Revision: 1.5 $ $Name: not supported by cvs2svn $ 9 * @date $Date: 2005-10-28 02:25:22 $ 10 10 * 11 11 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 24 24 25 25 testDescription tests[] = { 26 {test EOCParallax, 666, "psEOCParallax()", 0, false},27 {test Aberration, 667, "psAberration()", 0, false},28 {test GravityDeflect, 668, "psGravityDeflect()", 0, false},26 {testAberration, 666, "psAberration()", 0, false}, 27 {testGravityDeflect, 667, "psGravityDeflect()", 0, false}, 28 {testEOCParallax, 668, "psEOCParallax()", 0, false}, 29 29 {testEOCPrecession, 669, "psEOCPrecession()", 0, false}, 30 30 {testEOCPolar, 670, "psEOCPolar()", 0, false}, … … 41 41 } 42 42 43 psS32 testEOCParallax(void)44 {45 46 return 0;47 }48 49 43 psS32 testAberration(void) 50 44 { 45 psSphere *actual = NULL; 46 psSphere *apparent = psSphereAlloc(); 47 psSphere *direction = psSphereAlloc(); 48 psSphere *empty = NULL; 49 50 apparent->r = 0.2; 51 apparent->d = 0.2; 52 direction->r = 0.2035; 53 direction->d = 0.2035; 54 55 empty = psAberration(empty, actual, direction, 0.1); 56 if (empty != NULL) { 57 psError(PS_ERR_BAD_PARAMETER_NULL, false, 58 "psAberration failed to return NULL for NULL apparent input.\n"); 59 return 1; 60 } 61 empty = psAberration(empty, apparent, actual, 0.1); 62 if (empty != NULL) { 63 psError(PS_ERR_BAD_PARAMETER_NULL, false, 64 "psAberration failed to return NULL for NULL direction input.\n"); 65 return 2; 66 } 67 68 actual = psAberration(actual, apparent, direction, 0.4); 69 printf("\nactual = r,d = %.8g, %.8g\n", actual->r, actual->d); 70 71 psFree(actual); 72 psFree(apparent); 73 psFree(direction); 51 74 52 75 return 0; … … 79 102 } 80 103 81 82 104 actual = psGravityDeflection(actual, apparent, sun); 83 105 psSphere *result = psSphereSetOffset(apparent, actual, PS_SPHERICAL, PS_RADIAN); … … 88 110 psFree(apparent); 89 111 psFree(sun); 112 113 return 0; 114 } 115 116 psS32 testEOCParallax(void) 117 { 90 118 91 119 return 0; -
trunk/psLib/test/astro/tst_psSphereOps.c
r5446 r5450 6 6 * @author d-Rob, MHPCC 7 7 * 8 * @version $Revision: 1.1 0$ $Name: not supported by cvs2svn $9 * @date $Date: 2005-10-2 6 01:20:15$8 * @version $Revision: 1.11 $ $Name: not supported by cvs2svn $ 9 * @date $Date: 2005-10-28 02:25:22 $ 10 10 * 11 11 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 71 71 double q3 = cos(a3)*cos(DELTA_P/2); 72 72 73 if ( FLT_EPSILON < fabs(q0 - myST->q0)) {73 if (DBL_EPSILON < fabs(q0 - myST->q0)) { 74 74 psError(PS_ERR_UNKNOWN,true,"myST->q0 is %lf, should be %lf\n", myST->q0, q0); 75 75 return 2; 76 76 } 77 if ( FLT_EPSILON < fabs(q1 - myST->q1)) {77 if (DBL_EPSILON < fabs(q1 - myST->q1)) { 78 78 psError(PS_ERR_UNKNOWN,true,"myST->q1 is %f, should be %f\n", myST->q1, q1); 79 79 return 3; 80 80 } 81 if ( FLT_EPSILON < fabs(q2 - myST->q2)) {81 if (DBL_EPSILON < fabs(q2 - myST->q2)) { 82 82 psError(PS_ERR_UNKNOWN,true,"myST->q2 is %f, should be %f\n", myST->q2, q2); 83 83 return 4; 84 84 } 85 if ( FLT_EPSILON < fabs(q3 - myST->q3)) {85 if (DBL_EPSILON < fabs(q3 - myST->q3)) { 86 86 psError(PS_ERR_UNKNOWN,true,"myST->q0 is %f, should be %f\n", myST->q3, q3); 87 87 return 5; … … 239 239 240 240 // check ecliptic transforms for correctness 241 if ( abs(RAD_TO_DEG(ecliptic->r) - lambda[x]) > TOLERANCE ||242 abs(RAD_TO_DEG(ecliptic->d) - beta[x]) > TOLERANCE) {241 if (fabs(RAD_TO_DEG(ecliptic->r) - lambda[x]) > TOLERANCE || 242 fabs(RAD_TO_DEG(ecliptic->d) - beta[x]) > TOLERANCE) { 243 243 psError(PS_ERR_UNKNOWN, false, 244 244 "Ecliptic tranformation incorrect. Result is (%g,%g), expected (%g,%g)", … … 247 247 return 1; 248 248 } 249 if ( abs(RAD_TO_DEG(icrsFromEcliptic->r) - alpha[x]) > TOLERANCE ||250 abs(RAD_TO_DEG(icrsFromEcliptic->d) - delta[x]) > TOLERANCE) {249 if (fabs(RAD_TO_DEG(icrsFromEcliptic->r) - alpha[x]) > TOLERANCE || 250 fabs(RAD_TO_DEG(icrsFromEcliptic->d) - delta[x]) > TOLERANCE) { 251 251 psError(PS_ERR_UNKNOWN, false, 252 252 "ICRS for Ecliptic tranformation incorrect. Result is (%g,%g), expected (%g,%g)", … … 269 269 270 270 // check ecliptic transforms for correctness 271 if ( abs(RAD_TO_DEG(galactic->r) - l[x]) > TOLERANCE ||272 abs(RAD_TO_DEG(galactic->d) - b[x]) > TOLERANCE) {271 if (fabs(RAD_TO_DEG(galactic->r) - l[x]) > TOLERANCE || 272 fabs(RAD_TO_DEG(galactic->d) - b[x]) > TOLERANCE) { 273 273 psError(PS_ERR_UNKNOWN, false, 274 274 "Galactic tranformation incorrect. Result is (%g,%g), expected (%g,%g)", … … 280 280 return 3; 281 281 } 282 if ( abs(RAD_TO_DEG(icrsFromGalactic->r) - alpha[x]) > TOLERANCE ||283 abs(RAD_TO_DEG(icrsFromGalactic->d) - delta[x]) > TOLERANCE) {282 if (fabs(RAD_TO_DEG(icrsFromGalactic->r) - alpha[x]) > TOLERANCE || 283 fabs(RAD_TO_DEG(icrsFromGalactic->d) - delta[x]) > TOLERANCE) { 284 284 psError(PS_ERR_UNKNOWN, false, 285 285 "ICRS for Galactic tranformation incorrect. Result is (%g,%g), expected (%g,%g)", … … 498 498 output->d *= -1.0; 499 499 empty = psSphereGetOffset(origin, output, PS_LINEAR, PS_RADIAN); 500 if ( fabs(offset->r - empty->r) > 0.0001 || fabs(offset->d - empty->r) > 0.0001 ) {500 if ( fabs(offset->r - empty->r) > 0.0001 || abs(offset->d - empty->r) > 0.0001 ) { 501 501 psError(PS_ERR_BAD_PARAMETER_VALUE, false, 502 502 "psSphereGetOffset failed to return correct linear offset values.\n"); -
trunk/psLib/test/astro/verified/tst_psEarthOrientation.stderr
r5449 r5450 1 /***************************** TESTPOINT ******************************************\2 * TestFile: tst_psEarthOrientation.c *3 * TestPoint: psEarthOrientation{psEOCParallax()} *4 * TestType: Positive *5 \**********************************************************************************/6 7 8 ---> TESTPOINT PASSED (psEarthOrientation{psEOCParallax()} | tst_psEarthOrientation.c)9 10 1 /***************************** TESTPOINT ******************************************\ 11 2 * TestFile: tst_psEarthOrientation.c * … … 14 5 \**********************************************************************************/ 15 6 7 <DATE><TIME>|<HOST>|E|psAberration (FILE:LINENO) 8 Unallowable operation: apparent is NULL. 9 <DATE><TIME>|<HOST>|E|psAberration (FILE:LINENO) 10 Unallowable operation: direction is NULL. 16 11 17 12 ---> TESTPOINT PASSED (psEarthOrientation{psAberration()} | tst_psEarthOrientation.c) … … 29 24 30 25 ---> TESTPOINT PASSED (psEarthOrientation{psGravityDeflect()} | tst_psEarthOrientation.c) 26 27 /***************************** TESTPOINT ******************************************\ 28 * TestFile: tst_psEarthOrientation.c * 29 * TestPoint: psEarthOrientation{psEOCParallax()} * 30 * TestType: Positive * 31 \**********************************************************************************/ 32 33 34 ---> TESTPOINT PASSED (psEarthOrientation{psEOCParallax()} | tst_psEarthOrientation.c) 31 35 32 36 /***************************** TESTPOINT ******************************************\ -
trunk/psLib/test/astro/verified/tst_psEarthOrientation.stdout
r5449 r5450 1 2 actual = r,d = 0.10218436, 0.10218436 1 3 2 4 Apparent r,d = 0.2035,0.2035 Actual r,d = 0.2035000000002, 0.2035000000391
Note:
See TracChangeset
for help on using the changeset viewer.
