Changeset 3711 for trunk/psLib/src/astro/psCoord.c
- Timestamp:
- Apr 18, 2005, 3:22:59 PM (21 years ago)
- File:
-
- 1 edited
-
trunk/psLib/src/astro/psCoord.c (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/src/astro/psCoord.c
r3682 r3711 10 10 * @author GLG, MHPCC 11 11 * 12 * @version $Revision: 1.6 2$ $Name: not supported by cvs2svn $13 * @date $Date: 2005-04- 07 20:27:41$12 * @version $Revision: 1.63 $ $Name: not supported by cvs2svn $ 13 * @date $Date: 2005-04-19 01:22:59 $ 14 14 * 15 15 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 61 61 /* FUNCTION IMPLEMENTATION - LOCAL */ 62 62 /*****************************************************************************/ 63 /*****************************************************************************64 multiplyDPoly2D(trans1, trans2): Takes two 2-D polynomials as input and65 multiplies them. Basically, for each non-zero coeff in the trans1 coeff[][]66 array, you must multiply by all non-zero coeffs in trans2.67 68 XXX: Inefficient in that the out polynomial is allocated every time.69 *****************************************************************************/70 71 psDPolynomial2D *multiplyDPoly2D(psDPolynomial2D *trans1,72 psDPolynomial2D *trans2)73 {74 psS32 orderX = (trans1->nX + trans2->nX) - 1;75 psS32 orderY = (trans1->nX + trans2->nX) - 1;76 77 psDPolynomial2D *out = psDPolynomial2DAlloc(orderX, orderY, PS_POLYNOMIAL_ORD);78 for (psS32 i = 0 ; i < out->nX; i++) {79 for (psS32 j = 0 ; j < out->nY; j++) {80 out->coeff[i][j] = 0.0;81 out->mask[i][j] = 0;82 }83 }84 85 for (psS32 t1x = 0 ; t1x < trans1->nX ; t1x++) {86 for (psS32 t1y = 0 ; t1y < trans1->nY ; t1y++) {87 if (0.0 != trans1->coeff[t1x][t1y]) {88 for (psS32 t2x = 0 ; t2x < trans2->nX ; t2x++) {89 for (psS32 t2y = 0 ; t2y < trans2->nY ; t2y++) {90 out->coeff[t1x+t2x][t1y+t2y]+= (trans1->coeff[t1x][t1y] * trans2->coeff[t2x][t2y]);91 }92 }93 }94 }95 }96 return(out);97 }98 63 99 64 /*****************************************************************************/ … … 861 826 } 862 827 828 /***************************************************************************** 829 multiplyDPoly2D(trans1, trans2): Takes two 2-D polynomials as input and 830 multiplies them. Basically, for each non-zero coeff in the trans1 coeff[][] 831 array, you must multiply by all non-zero coeffs in trans2. 832 833 XXX: Inefficient in that the out polynomial is allocated every time. 834 *****************************************************************************/ 835 836 psDPolynomial2D *multiplyDPoly2D(psDPolynomial2D *trans1, 837 psDPolynomial2D *trans2) 838 { 839 //TRACE: printf("multiplyDPoly2D(%d %d: %d %d)\n", trans1->nX, trans1->nY, trans2->nX, trans2->nY); 840 psS32 orderX = (trans1->nX + trans2->nX) - 1; 841 psS32 orderY = (trans1->nY + trans2->nY) - 1; 842 843 psDPolynomial2D *out = psDPolynomial2DAlloc(orderX, orderY, PS_POLYNOMIAL_ORD); 844 //TRACE: printf("Creating poly (%d, %d)\n", orderX, orderY); 845 for (psS32 i = 0 ; i < out->nX; i++) { 846 for (psS32 j = 0 ; j < out->nY; j++) { 847 out->coeff[i][j] = 0.0; 848 out->mask[i][j] = 0; 849 } 850 } 851 852 for (psS32 t1x = 0 ; t1x < trans1->nX ; t1x++) { 853 for (psS32 t1y = 0 ; t1y < trans1->nY ; t1y++) { 854 if (0.0 != trans1->coeff[t1x][t1y]) { 855 for (psS32 t2x = 0 ; t2x < trans2->nX ; t2x++) { 856 for (psS32 t2y = 0 ; t2y < trans2->nY ; t2y++) { 857 /* VERIFY MACRO 858 if ((t1x+t2x) >= orderX) 859 printf("CRAP 1\n"); 860 if ((t1y+t2y) >= orderY) 861 printf("CRAP 2\n"); 862 */ 863 out->coeff[t1x+t2x][t1y+t2y]+= (trans1->coeff[t1x][t1y] * trans2->coeff[t2x][t2y]); 864 } 865 } 866 } 867 } 868 } 869 return(out); 870 } 863 871 864 872 … … 875 883 PS_PTR_CHECK_NULL(trans1, NULL); 876 884 PS_PTR_CHECK_NULL(trans2, NULL); 877 885 //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->nX, trans2->x->nY, trans2->y->nX, trans2->y->nY); 878 886 // 879 887 // Determine the size of the new psPlaneTransform. … … 930 938 // multiplied against themselves. This can easily be improved. 931 939 // 940 932 941 for (psS32 t2x = 0 ; t2x < trans2->x->nX ; t2x++) { 933 942 for (psS32 t2y = 0 ; t2y < trans2->x->nY ; t2y++) { 934 943 psDPolynomial2D *currPoly = psDPolynomial2DAlloc(1, 1, PS_POLYNOMIAL_ORD); 944 935 945 currPoly->coeff[0][0] = 1.0; 936 946 currPoly->mask[0][0] = 0; … … 938 948 939 949 if (trans2->x->mask[t2x][t2y] == 0) { 940 941 950 // Must raise trans1->y to the t2y-power. 942 951 for (psS32 c = 0 ; c < t2y; c++) { … … 965 974 966 975 967 968 976 for (psS32 t2x = 0 ; t2x < trans2->y->nX ; t2x++) { 969 977 for (psS32 t2y = 0 ; t2y < trans2->y->nY ; t2y++) { … … 1000 1008 } 1001 1009 1010 //TRACE: printf("Exiting combine()\n"); 1002 1011 return(myPT); 1003 1012 }
Note:
See TracChangeset
for help on using the changeset viewer.
