Changeset 4613 for trunk/psLib/src/astro/psCoord.c
- Timestamp:
- Jul 26, 2005, 2:36:01 PM (21 years ago)
- File:
-
- 1 edited
-
trunk/psLib/src/astro/psCoord.c (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/src/astro/psCoord.c
r4581 r4613 10 10 * @author GLG, MHPCC 11 11 * 12 * @version $Revision: 1.8 0$ $Name: not supported by cvs2svn $13 * @date $Date: 2005-07-2 0 01:21:13$12 * @version $Revision: 1.81 $ $Name: not supported by cvs2svn $ 13 * @date $Date: 2005-07-27 00:36:01 $ 14 14 * 15 15 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 212 212 psMemSetDeallocator(s, (psFreeFunc) sphereFree); 213 213 return(s); 214 } 215 216 static void cubeFree(psCube *c) 217 { 218 // There are non dynamic allocated items 219 } 220 221 psCube* psCubeAlloc(void) 222 { 223 psCube *c = psAlloc(sizeof(psCube)); 224 225 psMemSetDeallocator(c, (psFreeFunc) cubeFree); 226 return(c); 214 227 } 215 228 … … 1256 1269 return(NULL); 1257 1270 } 1271 1272 psCube *psSphereToCube(const psSphere *sphere) 1273 { 1274 if(sphere == NULL) { 1275 // psError(); 1276 return NULL; 1277 } 1278 1279 psCube *cube = NULL; 1280 1281 cube = psCubeAlloc(); 1282 cube->x = cos(sphere->d) * cos(sphere->r); 1283 cube->y = cos(sphere->d) * sin(sphere->r); 1284 cube->z = sin(sphere->d); 1285 cube->xErr = cos(sphere->dErr) * cos(sphere->rErr); 1286 cube->yErr = cos(sphere->dErr) * sin(sphere->rErr); 1287 cube->zErr = sin(sphere->dErr); 1288 1289 return(cube); 1290 } 1291 1292 psSphere *psCubeToSphere(const psCube *cube) 1293 { 1294 if(cube == NULL) { 1295 // psError(); 1296 return NULL; 1297 } 1298 1299 psSphere *sphere = NULL; 1300 sphere = psSphereAlloc(); 1301 // sphere->r = arctan(cube->x/cube->y); 1302 // sphere->d = arctan(sqrt(cube->x*cube->x + cube->y*cube->y)/cube->z); 1303 // sphere->rErr = arctan(cube->xErr/cube->yErr); 1304 // sphere->dErr = arctan(sqrt(cube->xErr*cube->xErr + cube->yErr*cube->yErr)/cube->zErr); 1305 sphere->r = 1 / (atan(cube->x/cube->y)); 1306 sphere->d = 1 / (atan(sqrt(cube->x*cube->x + cube->y*cube->y)/cube->z)); 1307 sphere->rErr = 1 / (atan(cube->xErr/cube->yErr)); 1308 sphere->dErr = 1 / (atan(sqrt(cube->xErr*cube->xErr + cube->yErr*cube->yErr)/cube->zErr)); 1309 1310 return(sphere); 1311 }
Note:
See TracChangeset
for help on using the changeset viewer.
