Changeset 5576
- Timestamp:
- Nov 22, 2005, 11:40:40 AM (20 years ago)
- Location:
- trunk/psLib/src
- Files:
-
- 3 edited
-
astro/psCoord.c (modified) (11 diffs)
-
math/psPolynomial.c (modified) (2 diffs)
-
math/psStats.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/src/astro/psCoord.c
r5544 r5576 10 10 * @author GLG, MHPCC 11 11 * 12 * @version $Revision: 1.9 0$ $Name: not supported by cvs2svn $13 * @date $Date: 2005-11- 18 19:46:09$12 * @version $Revision: 1.91 $ $Name: not supported by cvs2svn $ 13 * @date $Date: 2005-11-22 21:40:40 $ 14 14 * 15 15 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 140 140 true: if linear 141 141 false: otherwise 142 143 Why isn't this called p_psIsPlaneTransformLinear()? 142 144 *****************************************************************************/ 143 145 psBool p_psIsProjectionLinear(psPlaneTransform *transform) … … 324 326 XXX: Private Function. 325 327 326 piNormalize(): take an input angle in radians and convert it to the range 0:2*PI. 328 piNormalize(): take an input angle in radians and convert it to the range 329 0:2*PI. 327 330 *****************************************************************************/ 328 331 psF32 piNormalize(psF32 angle) … … 454 457 455 458 // Remove plate scales 456 psF64 x = coord->x /projection->Xs;457 psF64 y = coord->y /projection->Ys;459 psF64 x = coord->x * projection->Xs; 460 psF64 y = coord->y * projection->Ys; 458 461 459 462 // Perform inverse projection … … 514 517 psPolynomial2D *trans2) 515 518 { 516 //TRACE:printf("multiplyDPoly2D(%d %d: %d %d)\n", trans1->nX, trans1->nY, trans2->nX, trans2->nY);519 printf("multiplyDPoly2D(%d %d: %d %d)\n", trans1->nX, trans1->nY, trans2->nX, trans2->nY); 517 520 // XXX: OLD: psS32 orderX = (trans1->nX + trans2->nX) - 1; 518 521 // XXX: Verify this (the poly order change) 519 psS32 orderX = trans1->nX + trans2->nX + 1; 520 psS32 orderY = trans1->nY + trans2->nY + 1; 522 psS32 orderX = trans1->nX + trans2->nX; 523 psS32 orderY = trans1->nY + trans2->nY; 524 printf("out poly (nX, nY) is (%d, %d)\n", orderX, orderY); 521 525 522 526 // XXX: Verify this (the poly order change) 523 psPolynomial2D *out = psPolynomial2DAlloc(orderX -1, orderY-1, PS_POLYNOMIAL_ORD);527 psPolynomial2D *out = psPolynomial2DAlloc(orderX, orderY, PS_POLYNOMIAL_ORD); 524 528 //TRACE: printf("Creating poly (%d, %d)\n", orderX, orderY); 525 for (psS32 i = 0 ; i < (1 + out->nX); i++) {526 for (psS32 j = 0 ; j < (1 + out->nY); j++) {527 out->coeff[i][j] = 0.0;528 out->mask[i][j] = 0;529 }530 }531 529 532 530 for (psS32 t1x = 0 ; t1x < (1 + trans1->nX) ; t1x++) { … … 557 555 routine far too many times. 558 556 *****************************************************************************/ 559 psPlaneTransform *psPlaneTransformCombine(psPlaneTransform *out, 560 const psPlaneTransform *trans1, 561 const psPlaneTransform *trans2, 562 psRegion region, 563 int nSamples) 557 psPlaneTransform *psPlaneTransformCombine( 558 psPlaneTransform *out, 559 const psPlaneTransform *trans1, 560 const psPlaneTransform *trans2, 561 psRegion region, 562 int nSamples) 564 563 { 565 564 PS_ASSERT_PTR_NON_NULL(trans1, NULL); 566 565 PS_ASSERT_PTR_NON_NULL(trans2, NULL); 567 //TRACE: printf("psPlaneTransformCombine(%d, %d, %d, %d: %d, %d, %d, %d)\n", trans1->x->nX, trans1->x->nY, trans1->y->nX, trans1->y->nY, trans2->x->COOL_2D_nX, trans2->x->COOL_2D_nY, trans2->y->COOL_2D_nX, trans2->y->COOL_2D_nY); 566 printf("-------------------------------------------------------------------------------\n"); 567 printf("psPlaneTransformCombine(%d, %d) (%d, %d) (%d, %d) (%d, %d)\n", 568 trans1->x->nX, trans1->x->nY, trans1->y->nX, trans1->y->nY, 569 trans2->x->nX, trans2->x->nY, trans2->y->nX, trans2->y->nY); 570 printf("trans1->x is (%d, %d) order.\n", trans1->x->nX, trans1->x->nY); 571 printf("trans1->y is (%d, %d) order.\n", trans1->y->nX, trans1->y->nY); 572 printf("trans2->x is (%d, %d) order.\n", trans2->x->nX, trans2->x->nY); 573 printf("trans2->y is (%d, %d) order.\n", trans2->y->nX, trans2->y->nY); 568 574 // 569 575 // Determine the size of the new psPlaneTransform. 570 576 // 571 // PS_MAX( Number of x terms in T2->x * number of x terms in T1->x, 572 // Number of y terms in T2->x * number of x terms in T1->y, 573 psS32 orderXnX = PS_MAX(((1 + trans2->x->nX) * (1 + trans1->x->nX)), 574 ((1 + trans2->x->nY) * (1 + trans1->y->nX))); 575 psS32 orderXnY = PS_MAX(((1 + trans2->x->nX) * (1 + trans1->x->nY)), 576 ((1 + trans2->x->nY) * (1 + trans1->y->nY))); 577 578 psS32 orderYnX = PS_MAX(((1 + trans2->y->nX) * (1 + trans1->x->nX)), 579 ((1 + trans2->y->nY) * (1 + trans1->y->nX))); 580 psS32 orderYnY = PS_MAX(((1 + trans2->y->nX) * (1 + trans1->x->nY)), 581 ((1 + trans2->y->nY) * (1 + trans1->y->nY))); 577 psS32 orderXnX = PS_MAX((trans2->x->nX * trans1->x->nX), 578 (trans2->x->nY * trans1->y->nX)); 579 psS32 orderXnY = PS_MAX((trans2->x->nX * trans1->x->nY), 580 (trans2->x->nY * trans1->y->nY)); 581 582 psS32 orderYnX = PS_MAX((trans2->y->nX * trans1->x->nX), 583 (trans2->y->nY * trans1->y->nX)); 584 psS32 orderYnY = PS_MAX((trans2->y->nX * trans1->x->nY), 585 (trans2->y->nY * trans1->y->nY)); 582 586 psS32 orderX = PS_MAX(orderXnX, orderYnX); 583 587 psS32 orderY = PS_MAX(orderXnY, orderYnY); 588 printf("OLD (orderX, orderY) is (%d, %d)\n", orderX, orderY); 589 590 orderXnX = (trans2->x->nX * trans1->x->nX) + (trans2->x->nY * trans1->y->nX); 591 orderXnY = (trans2->x->nX * trans1->x->nY) + (trans2->x->nY * trans1->y->nY); 592 orderYnX = (trans2->y->nX * trans1->x->nX) + (trans2->y->nY * trans1->y->nX); 593 orderYnY = (trans2->y->nX * trans1->x->nY) + (trans2->y->nY * trans1->y->nY); 594 orderX = PS_MAX(orderXnX, orderYnX); 595 orderY = PS_MAX(orderXnY, orderYnY); 596 printf("(orderX, orderY) is (%d, %d)\n", orderX, orderY); 597 584 598 585 599 // … … 591 605 myPT = psPlaneTransformAlloc(orderX, orderY); 592 606 } else { 593 if (((1 + out->x->nX) == orderX) && ((1 + out->x->nY) == orderY) && 594 ((1 + out->y->nX) == orderX) && ((1 + out->y->nY) == orderY)) { 607 if ((out->x->nX == orderX) && 608 (out->x->nY == orderY) && 609 (out->y->nX == orderX) && 610 (out->y->nY == orderY)) { 595 611 myPT = out; 612 // 613 // Initialize the new psPlaneTransform, if necessary. 614 // 615 for (psS32 i = 0 ; i < orderX ; i++) { 616 for (psS32 j = 0 ; j < orderY ; j++) { 617 myPT->x->coeff[i][j] = 0.0; 618 myPT->x->mask[i][j] = 0; 619 myPT->y->coeff[i][j] = 0.0; 620 myPT->y->mask[i][j] = 0; 621 } 622 } 596 623 } else { 597 624 psFree(out); … … 599 626 } 600 627 } 601 602 // 603 // Initialize the new psPlaneTransform, if necessary. 604 // 605 for (psS32 i = 0 ; i < orderX ; i++) { 606 for (psS32 j = 0 ; j < orderY ; j++) { 607 myPT->x->coeff[i][j] = 0.0; 608 myPT->x->mask[i][j] = 0; 609 myPT->y->coeff[i][j] = 0.0; 610 myPT->y->mask[i][j] = 0; 611 } 612 } 628 printf("New polynomial is (%d %d %d %d)\n", myPT->x->nX, myPT->x->nY, myPT->y->nX, myPT->y->nY); 613 629 614 630 // … … 624 640 for (psS32 t2x = 0 ; t2x < (1 + trans2->x->nX) ; t2x++) { 625 641 for (psS32 t2y = 0 ; t2y < (1 + trans2->x->nX) ; t2y++) { 642 printf("-------------------- (t2x, t2y) (%d, %d) --------------------\n", t2x, t2y); 626 643 // XXX: Verify this (poly order/nterm change) 627 psPolynomial2D *currPoly = psPolynomial2DAlloc( 1-1, 1-1, PS_POLYNOMIAL_ORD);644 psPolynomial2D *currPoly = psPolynomial2DAlloc(0, 0, PS_POLYNOMIAL_ORD); 628 645 629 646 currPoly->coeff[0][0] = 1.0; … … 632 649 633 650 if (trans2->x->mask[t2x][t2y] == 0) { 634 // Must raise trans1->y to the t2y-power.635 for (psS32 c = 0 ; c < t2y ; c++) {651 // Must raise trans1->y to the (t2y-1)-power. 652 for (psS32 c = 0 ; c < t2y-1; c++) { 636 653 newPoly = multiplyDPoly2D(currPoly, trans1->y); 637 654 psFree(currPoly); … … 639 656 } 640 657 641 // Must raise trans1->x to the t2x-power.642 for (psS32 c = 0 ; c < t2x ; c++) {658 // Must raise trans1->x to the (t2x-1)-power. 659 for (psS32 c = 0 ; c < t2x-1; c++) { 643 660 newPoly = multiplyDPoly2D(currPoly, trans1->x); 644 661 psFree(currPoly); 645 662 currPoly = newPoly; 646 663 } 647 664 printf("trans1->x is (%d, %d) order.\n", trans1->x->nX, trans1->x->nY); 665 printf("trans1->x was raised to the %d power.\n", t2x); 666 printf("trans1->y is (%d, %d) order.\n", trans1->y->nX, trans1->y->nY); 667 printf("trans1->y was raised to the %d power.\n", t2y); 668 printf("HERE 00\n"); 669 printf("HEY (%d, %d) (%d, %d)\n", myPT->x->nX, myPT->x->nY, currPoly->nX, currPoly->nY); 648 670 // Set the appropriate coeffs in myPT->x 649 671 for (psS32 i = 0 ; i < (1 + currPoly->nX) ; i++) { 650 672 for (psS32 j = 0 ; j < (1 + currPoly->nY) ; j++) { 673 // printf(" HMMM (%d, %d)\n", i, j); 651 674 myPT->x->coeff[i][j]+= currPoly->coeff[i][j] * trans2->x->coeff[t2x][t2y]; 652 675 } 653 676 } 677 printf("HERE 01\n"); 654 678 } 655 679 psFree(currPoly); -
trunk/psLib/src/math/psPolynomial.c
r5542 r5576 7 7 * polynomials. It also contains a Gaussian functions. 8 8 * 9 * @version $Revision: 1.13 1$ $Name: not supported by cvs2svn $10 * @date $Date: 2005-11- 18 19:39:29$9 * @version $Revision: 1.132 $ $Name: not supported by cvs2svn $ 10 * @date $Date: 2005-11-22 21:40:40 $ 11 11 * 12 12 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 725 725 } 726 726 727 psPolynomial4D* psPolynomial4DAlloc( unsigned int nX, 728 unsigned int nY, 729 unsigned int nZ, 730 unsigned int nT, 731 psPolynomialType type) 727 psPolynomial4D* psPolynomial4DAlloc( 728 unsigned int nX, 729 unsigned int nY, 730 unsigned int nZ, 731 unsigned int nT, 732 psPolynomialType type) 732 733 { 733 734 PS_ASSERT_INT_NONNEGATIVE(nX, NULL); -
trunk/psLib/src/math/psStats.c
r5563 r5576 17 17 * 18 18 * 19 * @version $Revision: 1.15 3$ $Name: not supported by cvs2svn $20 * @date $Date: 2005-11-22 01:18:13$19 * @version $Revision: 1.154 $ $Name: not supported by cvs2svn $ 20 * @date $Date: 2005-11-22 21:40:40 $ 21 21 * 22 22 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii
Note:
See TracChangeset
for help on using the changeset viewer.
