Changeset 6230 for trunk/psLib/src/astro/psCoord.c
- Timestamp:
- Jan 27, 2006, 3:31:44 PM (20 years ago)
- File:
-
- 1 edited
-
trunk/psLib/src/astro/psCoord.c (modified) (10 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/src/astro/psCoord.c
r6204 r6230 10 10 * @author GLG, MHPCC 11 11 * 12 * @version $Revision: 1.10 1$ $Name: not supported by cvs2svn $13 * @date $Date: 2006-01-2 6 21:10:22$12 * @version $Revision: 1.102 $ $Name: not supported by cvs2svn $ 13 * @date $Date: 2006-01-28 01:31:44 $ 14 14 * 15 15 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 206 206 207 207 // XXX: Verify the order/nterms poly changes 208 psPlaneTransform* psPlaneTransformAlloc(int order1, int order2) 208 psPlaneTransform* psPlaneTransformAlloc(int order1, 209 int order2) 209 210 { 210 211 PS_ASSERT_INT_NONNEGATIVE(order1, NULL); … … 240 241 } 241 242 242 psPlane* psPlaneTransformApply( 243 psPlane* out, 244 const psPlaneTransform* transform, 245 const psPlane* coords) 243 psPlane* psPlaneTransformApply(psPlane* out, 244 const psPlaneTransform* transform, 245 const psPlane* coords) 246 246 { 247 247 PS_ASSERT_PTR_NON_NULL(transform, NULL); … … 267 267 268 268 // XXX: Verify the order/nterms poly changes 269 psPlaneDistort* psPlaneDistortAlloc(int order1, int order2, int order3, int order4) 269 psPlaneDistort* psPlaneDistortAlloc(int order1, 270 int order2, 271 int order3, 272 int order4) 270 273 { 271 274 PS_ASSERT_INT_NONNEGATIVE(order1, NULL); … … 347 350 } 348 351 349 psProjection* psProjectionAlloc( 350 double R, 351 double D, 352 double Xs, 353 double Ys, 354 psProjectionType type) 352 psProjection* psProjectionAlloc(double R, 353 double D, 354 double Xs, 355 double Ys, 356 psProjectionType type) 355 357 { 356 358 psProjection *p = psAlloc(sizeof(psProjection)); … … 372 374 373 375 374 psPlane* p_psProject( 375 psPlane *outPlane, 376 const psSphere* coord, 377 const psProjection* projection) 376 psPlane* p_psProject(psPlane *outPlane, 377 const psSphere* coord, 378 const psProjection* projection) 378 379 { 379 380 PS_ASSERT_PTR_NON_NULL(coord, NULL); … … 457 458 } 458 459 459 psSphere* p_psDeproject( 460 psSphere *outSphere, 461 const psPlane* coord, 462 const psProjection* projection) 460 psSphere* p_psDeproject(psSphere *outSphere, 461 const psPlane* coord, 462 const psProjection* projection) 463 463 { 464 464 PS_ASSERT_PTR_NON_NULL(coord, NULL); … … 604 604 routine far too many times. 605 605 *****************************************************************************/ 606 psPlaneTransform *psPlaneTransformCombine( 607 psPlaneTransform *out, 608 const psPlaneTransform *trans1, 609 const psPlaneTransform *trans2, 610 psRegion region, 611 int nSamples) 606 psPlaneTransform *psPlaneTransformCombine(psPlaneTransform *out, 607 const psPlaneTransform *trans1, 608 const psPlaneTransform *trans2, 609 psRegion region, 610 int nSamples) 612 611 { 613 612 psTrace(__func__, 3, "---- %s() begin ----\n", __func__); … … 1016 1015 } 1017 1016 1018 psPlane *psPlaneTransformDeriv( 1019 psPlane *out, 1020 const psPlaneTransform *transformation, 1021 const psPlane *coord 1022 ) 1017 psPlane *psPlaneTransformDeriv(psPlane *out, 1018 const psPlaneTransform *transformation, 1019 const psPlane *coord) 1023 1020 { 1024 1021 PS_ASSERT_PTR_NON_NULL(transformation, NULL); … … 1080 1077 } 1081 1078 return(out); 1079 } 1080 1081 psPixels *psPixelsTransform(psPixels *out, 1082 const psPixels *input, 1083 const psPlaneTransform *inToOut) 1084 { 1085 PS_ASSERT_PTR_NON_NULL(input, NULL); 1086 PS_ASSERT_PTR_NON_NULL(inToOut, NULL); 1087 PS_ASSERT_PTR_NON_NULL(inToOut->x, NULL); 1088 PS_ASSERT_PTR_NON_NULL(inToOut->y, NULL); 1089 if (out == NULL) { 1090 //XXX: Should the length (nalloc) be 1 and append be used everytime a pixel is added? 1091 // out = psPixelsAlloc(input->nalloc); 1092 out = psPixelsAlloc(1); 1093 } 1094 psPlane *coord = psPlaneAlloc(); 1095 psPlane *deriv = psPlaneAlloc(); 1096 psPlane *fxnVal = psPlaneAlloc(); 1097 1098 int i = 0; 1099 // int m = 0; 1100 // while (input->data.x[i] != 0.0 && input->data.y[i] != 0.0) { 1101 for ( i = 0; i < input->n; i++) { 1102 coord->x = input->data[i].x; 1103 coord->y = input->data[i].y; 1104 deriv = psPlaneTransformDeriv(deriv, inToOut, coord); 1105 fxnVal = psPlaneTransformApply(fxnVal, inToOut, coord); 1106 if (fabs(fxnVal->x - coord->x) < fabs(deriv->x) && 1107 fabs(fxnVal->y - coord->y) < fabs(deriv->y)) { 1108 int x = (int)(round(fabs(deriv->x))); 1109 int y = (int)(round(fabs(deriv->y))); 1110 for (int j = -x; j <= x; j++) { 1111 for (int k = -y; k <= y; k++) { 1112 // out->data[m].x = fxnVal->x + x; 1113 // out->data[m].y = fxnVal->y + y; 1114 // m++; 1115 out = p_psPixelsAppend(out, 1, (float)(fxnVal->x+j), 1116 (float)(fxnVal->y+k) ); 1117 } 1118 } 1119 } 1120 } 1121 1122 psFree(coord); 1123 psFree(deriv); 1124 psFree(fxnVal); 1125 return out; 1082 1126 } 1083 1127
Note:
See TracChangeset
for help on using the changeset viewer.
