Changeset 1311
- Timestamp:
- Jul 28, 2004, 10:22:22 AM (22 years ago)
- Location:
- trunk/psLib/src
- Files:
-
- 2 edited
-
astro/psCoord.c (modified) (9 diffs)
-
astronomy/psCoord.c (modified) (9 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/src/astro/psCoord.c
r1297 r1311 10 10 * @author George Gusciora, MHPCC 11 11 * 12 * @version $Revision: 1. 5$ $Name: not supported by cvs2svn $13 * @date $Date: 2004-07-2 7 05:30:55$12 * @version $Revision: 1.6 $ $Name: not supported by cvs2svn $ 13 * @date $Date: 2004-07-28 20:22:22 $ 14 14 * 15 15 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 23 23 #include "psMemory.h" 24 24 #include "psAbort.h" 25 #include "psTime.h" 25 26 #include <math.h> 26 27 #include <float.h> … … 133 134 } 134 135 135 // XXX: Add a date argument to determine the correct year. 136 psSphereTransform *psSphereTransformICRStoEcliptic(void) 137 { 138 double year = 2004.0;136 psSphereTransform *psSphereTransformICRStoEcliptic(psTime time) 137 { 138 struct tm *tmTime = psTimeToTM(time); 139 double year = (double) (1900 + tmTime->tm_year); 139 140 double T = year / 100.0; 140 141 double phi = -23.452294 + 0.013013*T + 0.000001639*T*T - 0.000000503*T*T*T; … … 145 146 } 146 147 147 // XXX: Add a date argument to determine the correct year.148 148 psSphereTransform *psSphereTransformEcliptictoICRS(void) 149 149 { 150 double year = 2004.0; 150 struct tm *tmTime = psTimeToTM(time); 151 double year = (double) (1900 + tmTime->tm_year); 151 152 double T = year / 100.0; 152 153 double phi = +23.452294 - 0.013013*T - 0.000001639*T*T + 0.000000503*T*T*T; … … 285 286 } 286 287 288 // XXX: Do I need to check for unacceptable transformation parameters? 289 // Maybe, if the points are on the North/South Pole, etc? 287 290 psSphere *psSphereGetOffset(const psSphere *restrict position1, 288 291 const psSphere *restrict position2, … … 290 293 psSphereOffsetUnit unit) 291 294 { 292 // psPlane lin; 295 psPlane *lin; 296 psProjection proj; 293 297 psSphere *tmp; 294 // psProjection proj;295 298 double tmpR = 0.0; 296 299 double tmpD = 0.0; 297 300 298 301 if (mode == PS_LINEAR) { 299 // XXX: I have no idea how to construct this. 300 return(NULL); 302 // XXX: I have no idea how to construct this. Maybe project both 303 // sperical positions onto the plane, set the origin at one of the 304 // points on the plane, then deproject? 305 306 // XXX: Do I need to somehow scale this projection? 307 // project position1? Will it project to (0.0, 0.0)? 308 proj.R = position1->r; 309 proj.D = position1->d; 310 proj.Xs = 1.0; 311 proj.Ys = 1.0; 312 proj.type = PS_PROJ_TAN; 313 314 lin = psProject(position2, proj); 315 tmp = psDeproject(lin, proj); 316 317 // XXX: Do we need to convert units in tmp? 318 return(tmp); 301 319 } else if (mode == PS_SPHERICAL) { 302 320 tmpR = position2->r - position1->r; … … 314 332 } else if (unit == PS_RADIAN) {} 315 333 else { 316 psAbort(__func__, "Unknow offset unit: 0x%x\n", unit);334 psAbort(__func__, "Unknown offset unit: 0x%x\n", unit); 317 335 } 318 336 … … 330 348 331 349 350 // XXX: Do I need to check for unacceptable transformation parameters? 351 // Maybe, if the points are on the North/South Pole, etc? 332 352 // XXX: I copied the algorithm from the ADD exactly. 333 353 psSphere *psSphereSetOffset(const psSphere *restrict position, … … 369 389 tmpD = offset->d; 370 390 } else { 371 psAbort(__func__, "Unknow offset unit: 0x%x\n", unit);391 psAbort(__func__, "Unknown offset unit: 0x%x\n", unit); 372 392 } 373 393 -
trunk/psLib/src/astronomy/psCoord.c
r1297 r1311 10 10 * @author George Gusciora, MHPCC 11 11 * 12 * @version $Revision: 1. 5$ $Name: not supported by cvs2svn $13 * @date $Date: 2004-07-2 7 05:30:55$12 * @version $Revision: 1.6 $ $Name: not supported by cvs2svn $ 13 * @date $Date: 2004-07-28 20:22:22 $ 14 14 * 15 15 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 23 23 #include "psMemory.h" 24 24 #include "psAbort.h" 25 #include "psTime.h" 25 26 #include <math.h> 26 27 #include <float.h> … … 133 134 } 134 135 135 // XXX: Add a date argument to determine the correct year. 136 psSphereTransform *psSphereTransformICRStoEcliptic(void) 137 { 138 double year = 2004.0;136 psSphereTransform *psSphereTransformICRStoEcliptic(psTime time) 137 { 138 struct tm *tmTime = psTimeToTM(time); 139 double year = (double) (1900 + tmTime->tm_year); 139 140 double T = year / 100.0; 140 141 double phi = -23.452294 + 0.013013*T + 0.000001639*T*T - 0.000000503*T*T*T; … … 145 146 } 146 147 147 // XXX: Add a date argument to determine the correct year.148 148 psSphereTransform *psSphereTransformEcliptictoICRS(void) 149 149 { 150 double year = 2004.0; 150 struct tm *tmTime = psTimeToTM(time); 151 double year = (double) (1900 + tmTime->tm_year); 151 152 double T = year / 100.0; 152 153 double phi = +23.452294 - 0.013013*T - 0.000001639*T*T + 0.000000503*T*T*T; … … 285 286 } 286 287 288 // XXX: Do I need to check for unacceptable transformation parameters? 289 // Maybe, if the points are on the North/South Pole, etc? 287 290 psSphere *psSphereGetOffset(const psSphere *restrict position1, 288 291 const psSphere *restrict position2, … … 290 293 psSphereOffsetUnit unit) 291 294 { 292 // psPlane lin; 295 psPlane *lin; 296 psProjection proj; 293 297 psSphere *tmp; 294 // psProjection proj;295 298 double tmpR = 0.0; 296 299 double tmpD = 0.0; 297 300 298 301 if (mode == PS_LINEAR) { 299 // XXX: I have no idea how to construct this. 300 return(NULL); 302 // XXX: I have no idea how to construct this. Maybe project both 303 // sperical positions onto the plane, set the origin at one of the 304 // points on the plane, then deproject? 305 306 // XXX: Do I need to somehow scale this projection? 307 // project position1? Will it project to (0.0, 0.0)? 308 proj.R = position1->r; 309 proj.D = position1->d; 310 proj.Xs = 1.0; 311 proj.Ys = 1.0; 312 proj.type = PS_PROJ_TAN; 313 314 lin = psProject(position2, proj); 315 tmp = psDeproject(lin, proj); 316 317 // XXX: Do we need to convert units in tmp? 318 return(tmp); 301 319 } else if (mode == PS_SPHERICAL) { 302 320 tmpR = position2->r - position1->r; … … 314 332 } else if (unit == PS_RADIAN) {} 315 333 else { 316 psAbort(__func__, "Unknow offset unit: 0x%x\n", unit);334 psAbort(__func__, "Unknown offset unit: 0x%x\n", unit); 317 335 } 318 336 … … 330 348 331 349 350 // XXX: Do I need to check for unacceptable transformation parameters? 351 // Maybe, if the points are on the North/South Pole, etc? 332 352 // XXX: I copied the algorithm from the ADD exactly. 333 353 psSphere *psSphereSetOffset(const psSphere *restrict position, … … 369 389 tmpD = offset->d; 370 390 } else { 371 psAbort(__func__, "Unknow offset unit: 0x%x\n", unit);391 psAbort(__func__, "Unknown offset unit: 0x%x\n", unit); 372 392 } 373 393
Note:
See TracChangeset
for help on using the changeset viewer.
