Changeset 5578
- Timestamp:
- Nov 22, 2005, 3:00:26 PM (21 years ago)
- Location:
- trunk/psLib
- Files:
-
- 2 edited
-
src/astro/psCoord.c (modified) (10 diffs)
-
test/astro/Makefile.am (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/src/astro/psCoord.c
r5576 r5578 10 10 * @author GLG, MHPCC 11 11 * 12 * @version $Revision: 1.9 1$ $Name: not supported by cvs2svn $13 * @date $Date: 2005-11-2 2 21:40:40$12 * @version $Revision: 1.92 $ $Name: not supported by cvs2svn $ 13 * @date $Date: 2005-11-23 00:59:58 $ 14 14 * 15 15 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 25 25 #include "psError.h" 26 26 #include "psLogMsg.h" 27 #include "psTrace.h" 27 28 #include "psErrorText.h" 28 29 #include "psMatrix.h" … … 517 518 psPolynomial2D *trans2) 518 519 { 519 printf("multiplyDPoly2D(%d %d: %d %d)\n", trans1->nX, trans1->nY, trans2->nX, trans2->nY); 520 // XXX: OLD: psS32 orderX = (trans1->nX + trans2->nX) - 1; 521 // XXX: Verify this (the poly order change) 520 psTrace(__func__, 4, "---- %s() begin ----\n", __func__); 521 psTrace(__func__, 5, "multiplyDPoly2D(%d %d: %d %d)\n", trans1->nX, trans1->nY, trans2->nX, trans2->nY); 522 522 psS32 orderX = trans1->nX + trans2->nX; 523 523 psS32 orderY = trans1->nY + trans2->nY; 524 printf("out poly (nX, nY) is (%d, %d)\n", orderX, orderY); 525 526 // XXX: Verify this (the poly order change) 524 psTrace(__func__, 5, "out poly (nX, nY) is (%d, %d)\n", orderX, orderY); 525 527 526 psPolynomial2D *out = psPolynomial2DAlloc(orderX, orderY, PS_POLYNOMIAL_ORD); 528 //TRACE: printf("Creating poly (%d, %d)\n", orderX, orderY);527 psTrace(__func__, 5, "Creating poly (%d, %d)\n", orderX, orderY); 529 528 530 529 for (psS32 t1x = 0 ; t1x < (1 + trans1->nX) ; t1x++) { … … 545 544 } 546 545 } 546 psTrace(__func__, 4, "---- %s() end ----\n", __func__); 547 547 return(out); 548 548 } … … 562 562 int nSamples) 563 563 { 564 psTrace(__func__, 3, "---- %s() begin ----\n", __func__); 565 psTrace(__func__, 3, "tracelevel(%s) is %d\n", __func__, psTraceGetLevel(__func__)); 566 564 567 PS_ASSERT_PTR_NON_NULL(trans1, NULL); 565 568 PS_ASSERT_PTR_NON_NULL(trans2, NULL); 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); 569 psTrace(__func__, 5, "trans1->x is (%d, %d) order.\n", trans1->x->nX, trans1->x->nY); 570 psTrace(__func__, 5, "trans1->y is (%d, %d) order.\n", trans1->y->nX, trans1->y->nY); 571 psTrace(__func__, 5, "trans2->x is (%d, %d) order.\n", trans2->x->nX, trans2->x->nY); 572 psTrace(__func__, 5, "trans2->y is (%d, %d) order.\n", trans2->y->nX, trans2->y->nY); 573 if (psTraceGetLevel(__func__) >= 6) { 574 PS_POLY_PRINT_2D(trans1->x); 575 PS_POLY_PRINT_2D(trans1->y); 576 PS_POLY_PRINT_2D(trans2->x); 577 PS_POLY_PRINT_2D(trans2->y); 578 } 579 574 580 // 575 581 // Determine the size of the new psPlaneTransform. 576 582 // 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)); 583 psS32 orderXnX = (trans2->x->nX * trans1->x->nX) + (trans2->x->nY * trans1->y->nX); 584 psS32 orderXnY = (trans2->x->nX * trans1->x->nY) + (trans2->x->nY * trans1->y->nY); 585 psS32 orderYnX = (trans2->y->nX * trans1->x->nX) + (trans2->y->nY * trans1->y->nX); 586 psS32 orderYnY = (trans2->y->nX * trans1->x->nY) + (trans2->y->nY * trans1->y->nY); 586 587 psS32 orderX = PS_MAX(orderXnX, orderYnX); 587 588 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 589 psTrace(__func__, 5, "The new (orderX, orderY) is (%d, %d)\n", orderX, orderY); 598 590 599 591 // … … 626 618 } 627 619 } 628 p rintf("New polynomial is(%d %d %d %d)\n", myPT->x->nX, myPT->x->nY, myPT->y->nX, myPT->y->nY);620 psTrace(__func__, 5, "New polynomial ranks are (%d %d %d %d)\n", myPT->x->nX, myPT->x->nY, myPT->y->nX, myPT->y->nY); 629 621 630 622 // … … 638 630 // 639 631 632 // 633 // Determine the new x-polynomial 634 // 635 psTrace(__func__, 5, "Determine the new x-polynomial\n"); 640 636 for (psS32 t2x = 0 ; t2x < (1 + trans2->x->nX) ; t2x++) { 641 for (psS32 t2y = 0 ; t2y < (1 + trans2->x->nX) ; t2y++) { 642 printf("-------------------- (t2x, t2y) (%d, %d) --------------------\n", t2x, t2y); 643 // XXX: Verify this (poly order/nterm change) 644 psPolynomial2D *currPoly = psPolynomial2DAlloc(0, 0, PS_POLYNOMIAL_ORD); 645 646 currPoly->coeff[0][0] = 1.0; 647 currPoly->mask[0][0] = 0; 648 psPolynomial2D *newPoly = NULL; 649 637 for (psS32 t2y = 0 ; t2y < (1 + trans2->x->nY) ; t2y++) { 638 psTrace(__func__, 6, "X: -------------------- (t2x, t2y) (%d, %d) --------------------\n", t2x, t2y); 650 639 if (trans2->x->mask[t2x][t2y] == 0) { 651 // Must raise trans1->y to the (t2y-1)-power. 652 for (psS32 c = 0 ; c < t2y-1; c++) { 653 newPoly = multiplyDPoly2D(currPoly, trans1->y); 654 psFree(currPoly); 655 currPoly = newPoly; 656 } 657 658 // Must raise trans1->x to the (t2x-1)-power. 659 for (psS32 c = 0 ; c < t2x-1; c++) { 640 psTrace(__func__, 6, "In this iteration, we raise trans1->x to the %d power and trans1->y to the %d-power.\n", t2x, t2y); 641 // Create the constant "f(x, y) = 1" polynomial. 642 psPolynomial2D *currPoly = psPolynomial2DAlloc(0, 0, PS_POLYNOMIAL_ORD); 643 currPoly->coeff[0][0] = 1.0; 644 645 psPolynomial2D *newPoly = NULL; 646 // Must raise trans1->x to the t2x-power. 647 for (psS32 c = 0 ; c < t2x; c++) { 660 648 newPoly = multiplyDPoly2D(currPoly, trans1->x); 661 649 psFree(currPoly); 662 650 currPoly = newPoly; 663 651 } 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);670 // Set the appropriate coeffs in myPT->x671 for (psS32 i = 0 ; i < (1 + currPoly->nX) ; i++) {672 for (psS32 j = 0 ; j < (1 + currPoly->nY) ; j++) {673 // printf(" HMMM (%d, %d)\n", i, j);674 myPT->x->coeff[i][j]+= currPoly->coeff[i][j] * trans2->x->coeff[t2x][t2y];675 }676 }677 printf("HERE 01\n");678 }679 psFree(currPoly);680 }681 }682 683 684 for (psS32 t2x = 0 ; t2x < (1 + trans2->y->nX) ; t2x++) {685 for (psS32 t2y = 0 ; t2y < (1 + trans2->y->nY) ; t2y++) {686 // XXX: Verify this (poly order/nterm change)687 psPolynomial2D *currPoly = psPolynomial2DAlloc(1-1, 1-1, PS_POLYNOMIAL_ORD);688 currPoly->coeff[0][0] = 1.0;689 currPoly->mask[0][0] = 0;690 psPolynomial2D *newPoly = NULL;691 692 if (trans2->y->mask[t2x][t2y] == 0) {693 652 694 653 // Must raise trans1->y to the t2y-power. … … 698 657 currPoly = newPoly; 699 658 } 700 659 if (psTraceGetLevel(__func__) >= 6) { 660 PS_POLY_PRINT_2D(currPoly); 661 } 662 663 // Set the appropriate coeffs in myPT->x 664 for (psS32 i = 0 ; i < (1 + currPoly->nX) ; i++) { 665 for (psS32 j = 0 ; j < (1 + currPoly->nY) ; j++) { 666 myPT->x->coeff[i][j]+= currPoly->coeff[i][j] * trans2->x->coeff[t2x][t2y]; 667 } 668 } 669 if (psTraceGetLevel(__func__) >= 6) { 670 PS_POLY_PRINT_2D(myPT->x); 671 } 672 psFree(currPoly); 673 } 674 } 675 } 676 if (psTraceGetLevel(__func__) >= 6) { 677 psTrace(__func__, 6, "The final x-polynomial\n"); 678 PS_POLY_PRINT_2D(myPT->x); 679 } 680 681 // 682 // Determine the new y-polynomial 683 // 684 psTrace(__func__, 5, "Determine the new y-polynomial\n"); 685 for (psS32 t2x = 0 ; t2x < (1 + trans2->y->nX) ; t2x++) { 686 for (psS32 t2y = 0 ; t2y < (1 + trans2->y->nY) ; t2y++) { 687 psTrace(__func__, 5, "Y: -------------------- (t2x, t2y) (%d, %d) --------------------\n", t2x, t2y); 688 if (trans2->y->mask[t2x][t2y] == 0) { 689 psTrace(__func__, 5, "In this iteration, we raise trans1->x to the %d power and trans1->y to the %d-power.\n", t2x, t2y); 690 // Create the constant "f(x, y) = 1" polynomial. 691 psPolynomial2D *currPoly = psPolynomial2DAlloc(0, 0, PS_POLYNOMIAL_ORD); 692 currPoly->coeff[0][0] = 1.0; 693 694 psPolynomial2D *newPoly = NULL; 701 695 // Must raise trans1->x to the t2x-power. 702 696 for (psS32 c = 0 ; c < t2x; c++) { … … 706 700 } 707 701 702 // Must raise trans1->y to the t2y-power. 703 for (psS32 c = 0 ; c < t2y; c++) { 704 newPoly = multiplyDPoly2D(currPoly, trans1->y); 705 psFree(currPoly); 706 currPoly = newPoly; 707 } 708 if (psTraceGetLevel(__func__) >= 6) { 709 PS_POLY_PRINT_2D(currPoly); 710 } 711 708 712 // Set the appropriate coeffs in myPT->x 709 713 for (psS32 i = 0 ; i < (1 + currPoly->nX) ; i++) { … … 712 716 } 713 717 } 718 if (psTraceGetLevel(__func__) >= 6) { 719 PS_POLY_PRINT_2D(myPT->x); 720 } 721 psFree(currPoly); 714 722 } 715 psFree(currPoly); 716 } 717 } 718 719 //TRACE: printf("Exiting combine()\n"); 723 } 724 } 725 if (psTraceGetLevel(__func__) >= 6) { 726 psTrace(__func__, 6, "The final y-polynomial\n"); 727 PS_POLY_PRINT_2D(myPT->y); 728 } 729 730 psTrace(__func__, 3, "---- %s() end ----\n", __func__); 720 731 return(myPT); 721 732 } -
trunk/psLib/test/astro/Makefile.am
r5511 r5578 7 7 TESTS = \ 8 8 tst_psCoord01 \ 9 tst_psCoord02 \ 9 10 tst_psTime_01 \ 10 11 tst_psTime_02 \ … … 22 23 tst_psSphereOps_SOURCES = tst_psSphereOps.c 23 24 tst_psCoord01_SOURCES = tst_psCoord01.c 25 tst_psCoord02_SOURCES = tst_psCoord02.c 24 26 tst_psEarthOrientation_SOURCES = tst_psEarthOrientation.c 25 27
Note:
See TracChangeset
for help on using the changeset viewer.
