Changeset 39352
- Timestamp:
- Feb 18, 2016, 6:22:28 AM (10 years ago)
- File:
-
- 1 edited
-
trunk/Ohana/src/libdvo/src/coordops.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Ohana/src/libdvo/src/coordops.c
r39225 r39352 65 65 // of the form (dX,dY) = f(X,Y), then if (dL,dM) = f(X,Y). 66 66 if (coords[0].Npolyterms == -1) { 67 myAssert (coords[0].offsetMap, "offsetMap is requested by not defined"); 68 float dX = AstromOffsetMapValue (coords->offsetMap, x, y, TRUE); 69 float dY = AstromOffsetMapValue (coords->offsetMap, x, y, FALSE); 70 if (isnan(dX)) dX = 0.0; 71 if (isnan(dY)) dY = 0.0; 72 x += dX; 73 y += dY; 67 if (coords[0].offsetMap) { 68 // myAssert (coords[0].offsetMap, "offsetMap is requested by not defined"); 69 float dX = AstromOffsetMapValue (coords->offsetMap, x, y, TRUE); 70 float dY = AstromOffsetMapValue (coords->offsetMap, x, y, FALSE); 71 if (isnan(dX)) dX = 0.0; 72 if (isnan(dY)) dY = 0.0; 73 x += dX; 74 y += dY; 75 } 74 76 } 75 77 … … 507 509 // of the form (dX,dY) = f(X,Y), then if (dL,dM) = f(X,Y). 508 510 if (coords[0].Npolyterms == -1) { 509 myAssert (coords[0].offsetMap, "offsetMap is requested by not defined"); 510 511 double xraw = *x; 512 double yraw = *y; 513 514 double dXo = 0.0; 515 double dYo = 0.0; 516 517 int i; 518 for (i = 0; i < 4; i++) { 519 double dX = AstromOffsetMapValue (coords->offsetMap, xraw, yraw, TRUE); 520 double dY = AstromOffsetMapValue (coords->offsetMap, xraw, yraw, FALSE); 521 522 if (isnan(dX)) dX = 0.0; 523 if (isnan(dY)) dY = 0.0; 524 525 dX -= dXo; 526 dY -= dYo; 527 528 xraw -= dX; 529 yraw -= dY; 530 531 dXo += dX; 532 dYo += dY; 533 } 534 535 *x = xraw; 536 *y = yraw; 537 538 // I need to iterate since the position at which I have first made the correction is 539 // not the true position. but if dX,dY is small and the gradient of dX,dY is also 540 // small, then even a single pass gets us close. 541 542 // XXX test this and use a while (hypot(dX,dY) > XXX) condition 511 // myAssert (coords[0].offsetMap, "offsetMap is requested by not defined"); 512 513 if (coords[0].offsetMap) { 514 515 double xraw = *x; 516 double yraw = *y; 517 518 double dXo = 0.0; 519 double dYo = 0.0; 520 521 int i; 522 for (i = 0; i < 4; i++) { 523 double dX = AstromOffsetMapValue (coords->offsetMap, xraw, yraw, TRUE); 524 double dY = AstromOffsetMapValue (coords->offsetMap, xraw, yraw, FALSE); 525 526 if (isnan(dX)) dX = 0.0; 527 if (isnan(dY)) dY = 0.0; 528 529 dX -= dXo; 530 dY -= dYo; 531 532 xraw -= dX; 533 yraw -= dY; 534 535 dXo += dX; 536 dYo += dY; 537 } 538 539 *x = xraw; 540 *y = yraw; 541 542 // I need to iterate since the position at which I have first made the correction is 543 // not the true position. but if dX,dY is small and the gradient of dX,dY is also 544 // small, then even a single pass gets us close. 545 546 // XXX test this and use a while (hypot(dX,dY) > XXX) condition 547 } 543 548 } 544 549 return (TRUE);
Note:
See TracChangeset
for help on using the changeset viewer.
