Changeset 1531
- Timestamp:
- Aug 13, 2004, 1:33:13 PM (22 years ago)
- Location:
- trunk/psLib/src
- Files:
-
- 2 edited
-
astro/psCoord.c (modified) (13 diffs)
-
astronomy/psCoord.c (modified) (13 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/src/astro/psCoord.c
r1497 r1531 10 10 * @author George Gusciora, MHPCC 11 11 * 12 * @version $Revision: 1.1 7$ $Name: not supported by cvs2svn $13 * @date $Date: 2004-08-1 2 01:32:21$12 * @version $Revision: 1.18 $ $Name: not supported by cvs2svn $ 13 * @date $Date: 2004-08-13 23:33:13 $ 14 14 * 15 15 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 90 90 } 91 91 92 // XXX: I have no idea how this works. This algorithm comes from an email 93 // from Gene. I assume (x,y) corresponds to (r,d) in the sphere coordinates. 94 95 // XXX: In Gene's email, there are different variables with similar names 96 // (y and Y) and in the code, there's cos_y, cos_Y, and cos(y). Verify that 97 // there are no typo's. 98 92 /****************************************************************************** 93 This algorithm comes from an email from Gene. I assume (x,y) corresponds to 94 (r,d) in the sphere coordinates. 95 96 XXX: In Gene's email, there are different variables with similar names (y 97 and Y) and in the code, there's cos_y, cos_Y, and cos(y). Verify that there 98 are no typo's. 99 *****************************************************************************/ 99 100 psSphere* psSphereTransformApply(psSphere* out, 100 101 const psSphereTransform* transform, … … 161 162 } 162 163 163 // XXX: Is this the correct way to calculate this?164 164 float cot(float x) 165 165 { … … 167 167 } 168 168 169 // This is some kind of arc tan function. 169 /****************************************************************************** 170 XXX: Verify this arc tan function. 171 *****************************************************************************/ 170 172 float arg(float x, 171 173 float y) … … 187 189 } 188 190 189 // XXX: Waiting for the definition of the PS_PROJ_PAR projection. 190 // XXX: Waiting for the definition of the PS_PROJ_GLS projection. 191 /****************************************************************************** 192 XXX: Waiting for the definition of the PS_PROJ_PAR projection. 193 XXX: Waiting for the definition of the PS_PROJ_GLS projection. 194 *****************************************************************************/ 191 195 psPlane* psProject(const psSphere* coord, 192 196 const psProjection* projection) … … 230 234 } 231 235 232 // XXX: Waiting for the definition of the PS_PROJ_PAR projection. 233 // XXX: Waiting for the definition of the PS_PROJ_GLS projection. 236 /****************************************************************************** 237 XXX: Waiting for the definition of the PS_PROJ_PAR projection. 238 XXX: Waiting for the definition of the PS_PROJ_GLS projection. 239 *****************************************************************************/ 234 240 psSphere* psDeproject(const psPlane* coord, 235 241 const psProjection* projection) … … 278 284 } 279 285 280 // XXX: Do I need to check for unacceptable transformation parameters? 281 // Maybe, if the points are on the North/South Pole, etc? 286 /****************************************************************************** 287 The basic idea is to project both positions onto the linear plane, with 288 position1 at the center, then calculate the linear offset between those 289 projections. 290 291 XXX: Do I need to check for unacceptable transformation parameters? Maybe, 292 if the points are on the North/South Pole, etc? 293 294 XXX: Do I need to somehow scale this projection? 295 *****************************************************************************/ 282 296 psSphere* psSphereGetOffset(const psSphere* restrict position1, 283 297 const psSphere* restrict position2, … … 285 299 psSphereOffsetUnit unit) 286 300 { 287 //psPlane* lin;301 psPlane* lin; 288 302 psProjection proj; 289 303 psSphere* tmp; … … 292 306 293 307 if (mode == PS_LINEAR) { 294 // XXX: I have no idea how to construct this. Maybe project both295 // sperical positions onto the plane, set the origin at one of the296 // points on the plane, then deproject?297 298 // XXX: Do I need to somehow scale this projection?299 // project position1? Will it project to (0.0, 0.0)?300 308 proj.R = position1->r; 301 309 proj.D = position1->d; … … 304 312 proj.type = PS_PROJ_TAN; 305 313 306 // lin = psProject(position2,proj);307 // tmp = psDeproject(lin,proj);314 lin = psProject(position2, &proj); 315 tmp = psDeproject(lin, &proj); 308 316 309 317 // XXX: Do we need to convert units in tmp? … … 328 336 329 337 tmp = (psSphere* ) psAlloc(sizeof(psSphere)); 330 tmp->r = tmpR; 331 tmp->d = tmpD; 338 // XXX: Wrap these to an acceptable range. Is this correct? 339 tmp->r = fmod(tmpR, 2*M_PI); 340 tmp->d = fmod(tmpD, 2*M_PI); 332 341 tmp->rErr = 0.0; 333 342 tmp->dErr = 0.0; 334 // XXX: Do we need to wrap these to an acceptable range? 343 335 344 return (tmp); 336 345 } … … 339 348 } 340 349 341 // XXX: Do I need to check for unacceptable transformation parameters? 342 // Maybe, if the points are on the North/South Pole, etc? 343 // XXX: I copied the algorithm from the ADD exactly. 350 /****************************************************************************** 351 XXX: Do I need to check for unacceptable transformation parameters? Maybe, 352 if the points are on the North/South Pole, etc? 353 354 XXX: Do I need to somehow scale this projection? 355 356 XXX: I copied the algorithm from the ADD exactly. 357 *****************************************************************************/ 358 344 359 psSphere* psSphereSetOffset(const psSphere* restrict position, 345 360 const psSphere* restrict offset, … … 384 399 385 400 tmp = (psSphere* ) psAlloc(sizeof(psSphere)); 401 // XXX: Is this an acceptable way to wrap the angular output? 386 402 tmp->r = position->r + tmpR; 387 tmp->r = position->d + tmpD; 403 tmp->r = fmod(tmp->r, 2.0*M_PI); 404 tmp->d = position->d + tmpD; 405 tmp->d = fmod(tmp->d, 2.0*M_PI); 388 406 tmp->rErr = 0.0; 389 407 tmp->dErr = 0.0; 390 408 391 // XXX: wrap tmp->r and tmp->d to the allowed range (-PI to PI)392 // and (0 to 2*PI).393 409 return (tmp); 394 410 } -
trunk/psLib/src/astronomy/psCoord.c
r1497 r1531 10 10 * @author George Gusciora, MHPCC 11 11 * 12 * @version $Revision: 1.1 7$ $Name: not supported by cvs2svn $13 * @date $Date: 2004-08-1 2 01:32:21$12 * @version $Revision: 1.18 $ $Name: not supported by cvs2svn $ 13 * @date $Date: 2004-08-13 23:33:13 $ 14 14 * 15 15 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 90 90 } 91 91 92 // XXX: I have no idea how this works. This algorithm comes from an email 93 // from Gene. I assume (x,y) corresponds to (r,d) in the sphere coordinates. 94 95 // XXX: In Gene's email, there are different variables with similar names 96 // (y and Y) and in the code, there's cos_y, cos_Y, and cos(y). Verify that 97 // there are no typo's. 98 92 /****************************************************************************** 93 This algorithm comes from an email from Gene. I assume (x,y) corresponds to 94 (r,d) in the sphere coordinates. 95 96 XXX: In Gene's email, there are different variables with similar names (y 97 and Y) and in the code, there's cos_y, cos_Y, and cos(y). Verify that there 98 are no typo's. 99 *****************************************************************************/ 99 100 psSphere* psSphereTransformApply(psSphere* out, 100 101 const psSphereTransform* transform, … … 161 162 } 162 163 163 // XXX: Is this the correct way to calculate this?164 164 float cot(float x) 165 165 { … … 167 167 } 168 168 169 // This is some kind of arc tan function. 169 /****************************************************************************** 170 XXX: Verify this arc tan function. 171 *****************************************************************************/ 170 172 float arg(float x, 171 173 float y) … … 187 189 } 188 190 189 // XXX: Waiting for the definition of the PS_PROJ_PAR projection. 190 // XXX: Waiting for the definition of the PS_PROJ_GLS projection. 191 /****************************************************************************** 192 XXX: Waiting for the definition of the PS_PROJ_PAR projection. 193 XXX: Waiting for the definition of the PS_PROJ_GLS projection. 194 *****************************************************************************/ 191 195 psPlane* psProject(const psSphere* coord, 192 196 const psProjection* projection) … … 230 234 } 231 235 232 // XXX: Waiting for the definition of the PS_PROJ_PAR projection. 233 // XXX: Waiting for the definition of the PS_PROJ_GLS projection. 236 /****************************************************************************** 237 XXX: Waiting for the definition of the PS_PROJ_PAR projection. 238 XXX: Waiting for the definition of the PS_PROJ_GLS projection. 239 *****************************************************************************/ 234 240 psSphere* psDeproject(const psPlane* coord, 235 241 const psProjection* projection) … … 278 284 } 279 285 280 // XXX: Do I need to check for unacceptable transformation parameters? 281 // Maybe, if the points are on the North/South Pole, etc? 286 /****************************************************************************** 287 The basic idea is to project both positions onto the linear plane, with 288 position1 at the center, then calculate the linear offset between those 289 projections. 290 291 XXX: Do I need to check for unacceptable transformation parameters? Maybe, 292 if the points are on the North/South Pole, etc? 293 294 XXX: Do I need to somehow scale this projection? 295 *****************************************************************************/ 282 296 psSphere* psSphereGetOffset(const psSphere* restrict position1, 283 297 const psSphere* restrict position2, … … 285 299 psSphereOffsetUnit unit) 286 300 { 287 //psPlane* lin;301 psPlane* lin; 288 302 psProjection proj; 289 303 psSphere* tmp; … … 292 306 293 307 if (mode == PS_LINEAR) { 294 // XXX: I have no idea how to construct this. Maybe project both295 // sperical positions onto the plane, set the origin at one of the296 // points on the plane, then deproject?297 298 // XXX: Do I need to somehow scale this projection?299 // project position1? Will it project to (0.0, 0.0)?300 308 proj.R = position1->r; 301 309 proj.D = position1->d; … … 304 312 proj.type = PS_PROJ_TAN; 305 313 306 // lin = psProject(position2,proj);307 // tmp = psDeproject(lin,proj);314 lin = psProject(position2, &proj); 315 tmp = psDeproject(lin, &proj); 308 316 309 317 // XXX: Do we need to convert units in tmp? … … 328 336 329 337 tmp = (psSphere* ) psAlloc(sizeof(psSphere)); 330 tmp->r = tmpR; 331 tmp->d = tmpD; 338 // XXX: Wrap these to an acceptable range. Is this correct? 339 tmp->r = fmod(tmpR, 2*M_PI); 340 tmp->d = fmod(tmpD, 2*M_PI); 332 341 tmp->rErr = 0.0; 333 342 tmp->dErr = 0.0; 334 // XXX: Do we need to wrap these to an acceptable range? 343 335 344 return (tmp); 336 345 } … … 339 348 } 340 349 341 // XXX: Do I need to check for unacceptable transformation parameters? 342 // Maybe, if the points are on the North/South Pole, etc? 343 // XXX: I copied the algorithm from the ADD exactly. 350 /****************************************************************************** 351 XXX: Do I need to check for unacceptable transformation parameters? Maybe, 352 if the points are on the North/South Pole, etc? 353 354 XXX: Do I need to somehow scale this projection? 355 356 XXX: I copied the algorithm from the ADD exactly. 357 *****************************************************************************/ 358 344 359 psSphere* psSphereSetOffset(const psSphere* restrict position, 345 360 const psSphere* restrict offset, … … 384 399 385 400 tmp = (psSphere* ) psAlloc(sizeof(psSphere)); 401 // XXX: Is this an acceptable way to wrap the angular output? 386 402 tmp->r = position->r + tmpR; 387 tmp->r = position->d + tmpD; 403 tmp->r = fmod(tmp->r, 2.0*M_PI); 404 tmp->d = position->d + tmpD; 405 tmp->d = fmod(tmp->d, 2.0*M_PI); 388 406 tmp->rErr = 0.0; 389 407 tmp->dErr = 0.0; 390 408 391 // XXX: wrap tmp->r and tmp->d to the allowed range (-PI to PI)392 // and (0 to 2*PI).393 409 return (tmp); 394 410 }
Note:
See TracChangeset
for help on using the changeset viewer.
