Changeset 5446 for trunk/psLib/src/astro/psEarthOrientation.c
- Timestamp:
- Oct 25, 2005, 3:20:15 PM (21 years ago)
- File:
-
- 1 edited
-
trunk/psLib/src/astro/psEarthOrientation.c (modified) (3 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
Note:
See TracChangeset
for help on using the changeset viewer.
