Changeset 5446
- Timestamp:
- Oct 25, 2005, 3:20:15 PM (21 years ago)
- Location:
- trunk/psLib
- Files:
-
- 5 edited
-
src/astro/psEarthOrientation.c (modified) (3 diffs)
-
src/astro/psEarthOrientation.h (modified) (2 diffs)
-
src/pslib_strict.h (modified) (2 diffs)
-
test/astro/tst_psEarthOrientation.c (modified) (3 diffs)
-
test/astro/tst_psSphereOps.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/src/astro/psEarthOrientation.c
r5235 r5446 6 6 * @ingroup EarthOrientation 7 7 * 8 * @author Dave Robbins, MHPCC 8 9 * @author Robert Daniel DeSonia, MHPCC 9 10 * 10 * @version $Revision: 1. 4$ $Name: not supported by cvs2svn $11 * @date $Date: 2005-10- 07 21:27:49$11 * @version $Revision: 1.5 $ $Name: not supported by cvs2svn $ 12 * @date $Date: 2005-10-26 01:20:15 $ 12 13 * 13 14 * Copyright 2005 Maui High Performance Computing Center, University of Hawaii … … 166 167 psSphere *psGravityDeflection(psSphere *apparent, psSphere *actual, psSphere *sun) 167 168 { 168 // calculating the apparent angle from the actual angle and the sun position 169 170 // first, calculate the angle between the sun vector and the actual vector 169 PS_ASSERT_PTR_NON_NULL(apparent, NULL); 170 PS_ASSERT_PTR_NON_NULL(sun, NULL); 171 172 // calculating the actual angle from the apparent angle and the sun position 173 174 // first, calculate the angle between the sun vector and the apparent vector 171 175 172 176 // Moving to cartesian first: XXX -- is this required? 173 177 psCube* sunVector = psSphereToCube(sun); 174 psCube* a ctualVector = psSphereToCube(actual);178 psCube* apparentVector = psSphereToCube(apparent); 175 179 176 180 // use dot product to calculate the angle of separation 177 181 // N.B., assuming the psSphereToCube function returns a unit vector. 178 double theta = acos(sunVector->x*a ctualVector->x +179 sunVector->y*a ctualVector->y +180 sunVector->z*a ctualVector->z);182 double theta = acos(sunVector->x*apparentVector->x + 183 sunVector->y*apparentVector->y + 184 sunVector->z*apparentVector->z); 181 185 182 186 double r0 = PS_AU * tan(theta); 183 184 187 double deflection = 4.0*PS_G*PS_M/(PS_C0*PS_C0*r0); 185 188 … … 187 190 double limit = SEC_TO_RAD(1.75); 188 191 if (deflection > limit) { 189 deflection = limit; 190 } 191 192 // bend the actual vector away from the sun vector by deflection angle. 192 // deflection = limit; 193 //if deflection is greater than limit, the light rays will hit the sun 194 psWarning("Invalid positions. Light ray will not be seen on earth.\n"); 195 psFree(apparentVector); 196 psFree(sunVector); 197 return actual; 198 } 199 200 if (actual == NULL) { 201 actual = psSphereAlloc(); 202 } else { 203 actual->r = 0.0; 204 actual->d = 0.0; 205 actual->rErr = 0.0; 206 actual->dErr = 0.0; 207 } 208 209 // bend the apparent vector away from the sun vector by deflection angle. 193 210 // XXX: Not sure how to do this. Dave thinks the formula should be: 194 211 // theta = atan(r0/d)*tan(deflection), phi = thete/tan(deflection) 195 196 return NULL; 212 theta = 0.0; 213 double phi = 0.0; 214 deflection = SEC_TO_RAD(deflection); 215 theta = atan(r0/PS_AU) * tan(deflection); 216 phi = sqrt( deflection*deflection - theta*theta ); 217 actual->r = theta; 218 actual->d = phi; 219 psFree(apparentVector); 220 psFree(sunVector); 221 return actual; 197 222 } 198 223 -
trunk/psLib/src/astro/psEarthOrientation.h
r5306 r5446 6 6 * @ingroup EarthOrientation 7 7 * 8 * @author Dave Robbins, MHPCC 8 9 * @author Robert Daniel DeSonia, MHPCC 9 10 * 10 * @version $Revision: 1. 3$ $Name: not supported by cvs2svn $11 * @date $Date: 2005-10- 13 20:23:57$11 * @version $Revision: 1.4 $ $Name: not supported by cvs2svn $ 12 * @date $Date: 2005-10-26 01:20:15 $ 12 13 * 13 14 * Copyright 2005 Maui High Performance Computing Center, University of Hawaii … … 55 56 ); 56 57 57 /** 58 /** Calculates the actual position of a star, given its apparent position and the 59 * position of the sun. 58 60 * 61 * The actual and apparent positions are represented as psSphere entries, as is 62 * position of the sun. If the value of actual is NULL, a new psSphere is allocated, 63 * otherwise the point to actual is used for the result. 59 64 * 60 * 65 * @return psSphere*: the apparent position of a star. 61 66 */ 62 67 psSphere *psGravityDeflection( 63 psSphere *apparent, ///< 64 psSphere *actual, ///< 65 psSphere *sun ///< 68 psSphere *apparent, ///< apparent position of star 69 psSphere *actual, ///< actual position of star 70 psSphere *sun ///< position of the sun 66 71 ); 67 72 -
trunk/psLib/src/pslib_strict.h
r5227 r5446 9 9 * @author Eric Van Alst, MHPCC 10 10 * 11 * @version $Revision: 1. 9$ $Name: not supported by cvs2svn $12 * @date $Date: 2005-10- 06 02:41:07$11 * @version $Revision: 1.10 $ $Name: not supported by cvs2svn $ 12 * @date $Date: 2005-10-26 01:20:14 $ 13 13 * 14 14 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 31 31 #include "psCoord.h" 32 32 #include "psSphereOps.h" 33 #include "psEarthOrientation.h" 33 34 /// @} 34 35 -
trunk/psLib/test/astro/tst_psEarthOrientation.c
r5306 r5446 6 6 * @author d-Rob, MHPCC 7 7 * 8 * @version $Revision: 1. 2$ $Name: not supported by cvs2svn $9 * @date $Date: 2005-10- 13 20:23:57$8 * @version $Revision: 1.3 $ $Name: not supported by cvs2svn $ 9 * @date $Date: 2005-10-26 01:20:15 $ 10 10 * 11 11 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 15 15 #include "pslib_strict.h" 16 16 17 static psS32 testEOCParallax(void); 18 static psS32 testAberration(void); 19 static psS32 testGravityDeflect(void); 20 static psS32 testEOCPrecession(void); 21 static psS32 testEOCPolar(void); 22 static psS32 testEOCNutation(void); 23 static psS32 testSphereRotTransforms(void); 24 17 25 testDescription tests[] = { 26 {testEOCParallax, 666, "psEOCParallax()", 0, false}, 27 {testAberration, 667, "psAberration()", 0, false}, 28 {testGravityDeflect, 668, "psGravityDeflect()", 0, false}, 29 {testEOCPrecession, 669, "psEOCPrecession()", 0, false}, 30 {testEOCPolar, 670, "psEOCPolar()", 0, false}, 31 {testEOCNutation, 671, "psEOCNutation()", 0, false}, 32 {testSphereRotTransforms, 672, "psSphereRotTransforms()", 0, false}, 18 33 {NULL} 19 34 }; … … 23 38 psLogSetLevel( PS_LOG_INFO ); 24 39 25 return ( ! runTestSuite( stderr, "ps Coord", tests, argc, argv ) );40 return ( ! runTestSuite( stderr, "psEarthOrientation", tests, argc, argv ) ); 26 41 } 27 42 43 psS32 testEOCParallax(void) 44 { 28 45 46 return 0; 47 } 29 48 49 psS32 testAberration(void) 50 { 51 52 return 0; 53 } 54 55 psS32 testGravityDeflect(void) 56 { 57 58 psSphere *actual = NULL; 59 psSphere *apparent = psSphereAlloc(); 60 psSphere *sun = psSphereAlloc(); 61 62 sun->r = 0.2; 63 sun->d = 0.2; 64 apparent->r = 0.2035; 65 apparent->d = 0.2035; 66 67 actual = psGravityDeflection(apparent, actual, sun); 68 psSphere *result = psSphereSetOffset(apparent, actual, PS_SPHERICAL, PS_RADIAN); 69 printf("\nApparent r,d = %.13g,%.13g Actual r,d = %.13g, %.13g \n", 70 apparent->r, apparent->d, result->r, result->d); 71 psFree(result); 72 psFree(actual); 73 psFree(apparent); 74 psFree(sun); 75 76 return 0; 77 } 78 79 psS32 testEOCPrecession(void) 80 { 81 82 return 0; 83 } 84 85 psS32 testEOCPolar(void) 86 { 87 88 return 0; 89 } 90 91 psS32 testEOCNutation(void) 92 { 93 94 return 0; 95 } 96 97 psS32 testSphereRotTransforms(void) 98 { 99 100 return 0; 101 } 102 -
trunk/psLib/test/astro/tst_psSphereOps.c
r5444 r5446 6 6 * @author d-Rob, MHPCC 7 7 * 8 * @version $Revision: 1. 9$ $Name: not supported by cvs2svn $9 * @date $Date: 2005-10-2 5 00:38:00$8 * @version $Revision: 1.10 $ $Name: not supported by cvs2svn $ 9 * @date $Date: 2005-10-26 01:20:15 $ 10 10 * 11 11 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 35 35 psLogSetLevel( PS_LOG_INFO ); 36 36 37 return ( ! runTestSuite( stderr, "ps Coord", tests, argc, argv ) );37 return ( ! runTestSuite( stderr, "psSphereOps", tests, argc, argv ) ); 38 38 } 39 39
Note:
See TracChangeset
for help on using the changeset viewer.
