Changeset 3182 for trunk/psLib/src/astronomy
- Timestamp:
- Feb 9, 2005, 4:36:42 PM (21 years ago)
- Location:
- trunk/psLib/src/astronomy
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/src/astronomy/astronomy.i
r3169 r3182 17 17 // add a method to add primitives to metadata 18 18 %inline %{ 19 psBool psMetadataAddStr(psMetadata* md, psS32 where, const char* name, const char* comment, const char* value) { 19 psBool psMetadataAddStr(psMetadata* md, psS32 where, const char* name, 20 const char* comment, const char* value) { 20 21 return psMetadataAdd(md,where,name,PS_TYPE_PTR, PS_META_STR,comment,value); 21 22 } 22 psBool psMetadataAddF32(psMetadata* md, psS32 where, const char* name, const char* comment, psF32 value) { 23 psBool psMetadataAddF32(psMetadata* md, 24 psS32 where, 25 const char* name, 26 const char* comment, 27 psF32 value) 28 { 23 29 return psMetadataAdd(md,where,name,PS_TYPE_F32, PS_META_PRIMITIVE,comment,value); 24 30 } 25 psBool psMetadataAddF64(psMetadata* md, psS32 where, const char* name, const char* comment, psF64 value) { 31 32 psBool psMetadataAddF64(psMetadata* md, 33 psS32 where, 34 const char* name, 35 const char* comment, 36 psF64 value) 37 { 26 38 return psMetadataAdd(md,where,name,PS_TYPE_F64, PS_META_PRIMITIVE,comment,value); 27 39 } 28 psBool psMetadataAddS32(psMetadata* md, psS32 where, const char* name, const char* comment, psS32 value) { 40 41 psBool psMetadataAddS32(psMetadata* md, 42 psS32 where, 43 const char* name, 44 const char* comment, 45 psS32 value) 46 { 29 47 return psMetadataAdd(md,where,name,PS_TYPE_S32, PS_META_PRIMITIVE,comment,value); 30 48 } 31 49 32 psMetadataItem* psMetadataItemAllocStr(const char* name, const char* comment, const char* value) { 50 psMetadataItem* psMetadataItemAllocStr(const char* name, 51 const char* comment, 52 const char* value) 53 { 33 54 return psMetadataItemAlloc(name, PS_TYPE_PTR, PS_META_STR, comment, value); 34 55 } 35 psMetadataItem* psMetadataItemAllocF32(const char* name, const char* comment, psF32 value) { 56 57 psMetadataItem* psMetadataItemAllocF32(const char* name, 58 const char* comment, 59 psF32 value) 60 { 36 61 return psMetadataItemAlloc(name, PS_TYPE_F32, PS_META_PRIMITIVE, comment, value); 37 62 } 38 psMetadataItem* psMetadataItemAllocF64(const char* name, const char* comment, psF64 value) { 63 64 psMetadataItem* psMetadataItemAllocF64(const char* name, 65 const char* comment, 66 psF64 value) 67 { 39 68 return psMetadataItemAlloc(name, PS_TYPE_F64, PS_META_PRIMITIVE, comment, value); 40 69 } 41 psMetadataItem* psMetadataItemAllocS32(const char* name, const char* comment, psS32 value) { 70 71 psMetadataItem* psMetadataItemAllocS32(const char* name, 72 const char* comment, 73 psS32 value) 74 { 42 75 return psMetadataItemAlloc(name, PS_TYPE_S32, PS_META_PRIMITIVE, comment, value); 43 76 } -
trunk/psLib/src/astronomy/psCoord.c
r3114 r3182 10 10 * @author GLG, MHPCC 11 11 * 12 * @version $Revision: 1. 49$ $Name: not supported by cvs2svn $13 * @date $Date: 2005-02- 03 00:45:06$12 * @version $Revision: 1.50 $ $Name: not supported by cvs2svn $ 13 * @date $Date: 2005-02-10 02:36:41 $ 14 14 * 15 15 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 267 267 { 268 268 while (angle < FLT_EPSILON) { 269 angle+= M_PI;270 } 271 272 while (angle >= M_PI) {273 angle-= M_PI;269 angle+=PS_PI; 270 } 271 272 while (angle >= PS_PI) { 273 angle-=PS_PI; 274 274 } 275 275 return(angle); … … 547 547 R = PS_SQRT_F32((coord->x * coord->x) + (coord->y * coord->y)); 548 548 tmp->d = atan2(-coord->y, coord->x); 549 tmp->r = acos((R * M_PI) / 180.0);549 tmp->r = acos((R * PS_PI) / 180.0); 550 550 551 551 } else if (projection->type == PS_PROJ_CAR) { … … 555 555 } else if (projection->type == PS_PROJ_MER) { 556 556 tmp->d = coord->x; 557 tmp->r = (2.0 * atan(exp((coord->y * M_PI / 180.0)))) - 180.0;557 tmp->r = (2.0 * atan(exp((coord->y * PS_PI / 180.0)))) - 180.0; 558 558 559 559 } else if (projection->type == PS_PROJ_AIT) { 560 chu1 = (coord->x * M_PI) / 720.0;560 chu1 = (coord->x * PS_PI) / 720.0; 561 561 chu1 *= chu1; 562 chu2 = (coord->y * M_PI) / 360.0;562 chu2 = (coord->y * PS_PI) / 360.0; 563 563 chu2 *= chu2; 564 564 chu = PS_SQRT_F32(1.0 - chu1 - chu2); 565 tmp->d = 2.0 * atan2((2.0 * chu * chu) - 1.0, (coord->x * chu * M_PI) / 360.0);566 tmp->r = asin((coord->y * chu * M_PI) / 180.0);565 tmp->d = 2.0 * atan2((2.0 * chu * chu) - 1.0, (coord->x * chu * PS_PI) / 360.0); 566 tmp->r = asin((coord->y * chu * PS_PI) / 180.0); 567 567 568 568 } else if (projection->type == PS_PROJ_PAR) { … … 640 640 // Wrap these to an acceptable range. This assumes that all 641 641 // angles are in radians. 642 tmp->r = fmod(tmp->r, 2* M_PI);643 tmp->d = fmod(tmp->d, 2* M_PI);642 tmp->r = fmod(tmp->r, 2*PS_PI); 643 tmp->d = fmod(tmp->d, 2*PS_PI); 644 644 tmp->rErr = 0.0; 645 645 tmp->dErr = 0.0; … … 731 731 tmp = (psSphere* ) psAlloc(sizeof(psSphere)); 732 732 tmp->r = position->r + tmpR; 733 tmp->r = fmod(tmp->r, 2.0* M_PI);733 tmp->r = fmod(tmp->r, 2.0*PS_PI); 734 734 tmp->d = position->d + tmpD; 735 tmp->d = fmod(tmp->d, 2.0* M_PI);735 tmp->d = fmod(tmp->d, 2.0*PS_PI); 736 736 tmp->rErr = 0.0; 737 737 tmp->dErr = 0.0; -
trunk/psLib/src/astronomy/psTime.c
r3114 r3182 10 10 * @author Ross Harman, MHPCC 11 11 * 12 * @version $Revision: 1.5 0$ $Name: not supported by cvs2svn $13 * @date $Date: 2005-02- 03 00:45:06$12 * @version $Revision: 1.51 $ $Name: not supported by cvs2svn $ 13 * @date $Date: 2005-02-10 02:36:41 $ 14 14 * 15 15 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 43 43 44 44 /** Two times pi with double precision accuracy */ 45 #define TWOPI (2.0* M_PI)45 #define TWOPI (2.0*PS_PI) 46 46 47 47 /** Conversion from radians to degrees */ 48 #define R2DEG = (180.0/ M_PI)48 #define R2DEG = (180.0/PS_PI) 49 49 50 50 /** Maximum length of time string */ … … 548 548 549 549 t = 2000.0 + (mjd - 51544.03)/365.2422; 550 dut2ut1 = 0.022*sin(TWOPI*t) - 0.012*cos(TWOPI*t) - 0.006*sin(4.0* M_PI*t) + 0.007*cos(4.0*M_PI*t);550 dut2ut1 = 0.022*sin(TWOPI*t) - 0.012*cos(TWOPI*t) - 0.006*sin(4.0*PS_PI*t) + 0.007*cos(4.0*PS_PI*t); 551 551 result = dut->data.F64[0] + dut->data.F64[1]*(mjd - dut->data.F64[2]) - dut2ut1; 552 552 … … 677 677 } 678 678 679 // Create output sphere and convert arcsec to radians (i.e. x/60/60* M_PI/180)679 // Create output sphere and convert arcsec to radians (i.e. x/60/60*PS_PI/180) 680 680 output = psAlloc(sizeof(psSphere)); 681 output->r = x * M_PI / 648000.0;682 output->d = y * M_PI / 648000.0;681 output->r = x * PS_PI / 648000.0; 682 output->d = y * PS_PI / 648000.0; 683 683 684 684 return output;
Note:
See TracChangeset
for help on using the changeset viewer.
