Changeset 3714
- Timestamp:
- Apr 18, 2005, 6:16:02 PM (21 years ago)
- Location:
- trunk/psLib
- Files:
-
- 9 edited
-
src/astro/psCoord.c (modified) (4 diffs)
-
src/astronomy/psCoord.c (modified) (4 diffs)
-
src/dataManip/psFunctions.c (modified) (2 diffs)
-
src/image/psImageStats.c (modified) (2 diffs)
-
src/imageops/psImageStats.c (modified) (2 diffs)
-
src/math/psPolynomial.c (modified) (2 diffs)
-
src/math/psSpline.c (modified) (2 diffs)
-
test/astronomy/tst_psAstrometry01.c (modified) (4 diffs)
-
test/image/Makefile.am (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/src/astro/psCoord.c
r3711 r3714 10 10 * @author GLG, MHPCC 11 11 * 12 * @version $Revision: 1.6 3$ $Name: not supported by cvs2svn $13 * @date $Date: 2005-04-19 0 1:22:59$12 * @version $Revision: 1.64 $ $Name: not supported by cvs2svn $ 13 * @date $Date: 2005-04-19 04:16:02 $ 14 14 * 15 15 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 84 84 X1 = (-D + ((F*A)/C)) / (E - ((F*B)/C)) + 85 85 (X2 * -((F/C) / (E - ((F*B)/C)))) + 86 (Y2 * (1.0 / (E - ((F*B)/C))));87 Y1 = (-D + ((E*A)/B))/(F - ((C*E)/B)) +88 (X2 * -((E/B) / (F - ((C*E)/B)))) +89 (Y2 * (1.0 / (F - ((C*E)/B))));86 (Y2 * (1.0 / (E - ((F*B)/C)))); 87 Y1 = (-D + ((E*A)/B))/(F - ((C*E)/B)) + 88 (X2 * -((E/B) / (F - ((C*E)/B)))) + 89 (Y2 * (1.0 / (F - ((C*E)/B)))); 90 90 91 91 XXX: Since thre is now a general psPlaneTransformInvert() function, we 92 92 should rename this. 93 94 X1, Y1 = (2, 3) 95 96 X2 = 1 + 4 + 9 = 14 97 Y2 = 4 + 10 + 18 = 32 98 99 in inverse 100 101 Y1 = (32 - ((5/2) * 14) - 4 + ((5)/2)) / (6 - ((15)/2)); 102 Y1 = (32 - 35 - 4 + (5/2)) / (6 - 15/2); 103 Y1 = (-7 + (5/2)) / (12/2 - 15/2); 104 Y1 = (-7 + (5/2)) / (-3/2); 105 Y1 = (-14/2 + 5/2) / (-3/2); 106 Y1 = (-9/2) / (-3/2); 107 Y1 = (9/2) / (3/2); 108 Y1 = 3 109 110 X1 = (Y2 - ((F/C) * X2) - D + ((F*A)/C)) / (E - ((F*B)/C)); 111 X1 = (32 - ((6/3) * 14) - 4 + ((6)/3)) / (5 - ((12)/3)); 112 X1 = (32 - (2 * 14) - 4 + 2 / (5 - 4); 113 X1 = (32 - 28 - 4 + 2) / 1; 114 X1 = 2; 93 115 94 116 *****************************************************************************/ … … 125 147 psPlaneTransform *out = psPlaneTransformAlloc(2, 2); 126 148 127 out->x->coeff[0][0] = -D + ((F*A)/C) / (E - ((F*B)/C));149 out->x->coeff[0][0] = (-D + ((F*A)/C)) / (E - ((F*B)/C)); 128 150 out->x->coeff[1][0] = -(F/C) / (E - ((F*B)/C)); 129 151 out->x->coeff[0][1] = 1.0 / (E - ((F*B)/C)); 130 out->y->coeff[0][0] = -D + ((E*A)/B) / (F - ((C*E)/B));152 out->y->coeff[0][0] = (-D + ((E*A)/B)) / (F - ((C*E)/B)); 131 153 out->y->coeff[1][0] = -(E/B) / (F - ((C*E)/B)); 132 154 out->y->coeff[0][1] = 1.0 / (F - ((C*E)/B)); … … 1140 1162 // 1141 1163 if (p_psIsProjectionLinear((psPlaneTransform *) in)) { 1142 printf("COOL: is linear\n");1143 1164 return(p_psPlaneTransformLinearInvert((psPlaneTransform *) in)); 1144 1165 } -
trunk/psLib/src/astronomy/psCoord.c
r3711 r3714 10 10 * @author GLG, MHPCC 11 11 * 12 * @version $Revision: 1.6 3$ $Name: not supported by cvs2svn $13 * @date $Date: 2005-04-19 0 1:22:59$12 * @version $Revision: 1.64 $ $Name: not supported by cvs2svn $ 13 * @date $Date: 2005-04-19 04:16:02 $ 14 14 * 15 15 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 84 84 X1 = (-D + ((F*A)/C)) / (E - ((F*B)/C)) + 85 85 (X2 * -((F/C) / (E - ((F*B)/C)))) + 86 (Y2 * (1.0 / (E - ((F*B)/C))));87 Y1 = (-D + ((E*A)/B))/(F - ((C*E)/B)) +88 (X2 * -((E/B) / (F - ((C*E)/B)))) +89 (Y2 * (1.0 / (F - ((C*E)/B))));86 (Y2 * (1.0 / (E - ((F*B)/C)))); 87 Y1 = (-D + ((E*A)/B))/(F - ((C*E)/B)) + 88 (X2 * -((E/B) / (F - ((C*E)/B)))) + 89 (Y2 * (1.0 / (F - ((C*E)/B)))); 90 90 91 91 XXX: Since thre is now a general psPlaneTransformInvert() function, we 92 92 should rename this. 93 94 X1, Y1 = (2, 3) 95 96 X2 = 1 + 4 + 9 = 14 97 Y2 = 4 + 10 + 18 = 32 98 99 in inverse 100 101 Y1 = (32 - ((5/2) * 14) - 4 + ((5)/2)) / (6 - ((15)/2)); 102 Y1 = (32 - 35 - 4 + (5/2)) / (6 - 15/2); 103 Y1 = (-7 + (5/2)) / (12/2 - 15/2); 104 Y1 = (-7 + (5/2)) / (-3/2); 105 Y1 = (-14/2 + 5/2) / (-3/2); 106 Y1 = (-9/2) / (-3/2); 107 Y1 = (9/2) / (3/2); 108 Y1 = 3 109 110 X1 = (Y2 - ((F/C) * X2) - D + ((F*A)/C)) / (E - ((F*B)/C)); 111 X1 = (32 - ((6/3) * 14) - 4 + ((6)/3)) / (5 - ((12)/3)); 112 X1 = (32 - (2 * 14) - 4 + 2 / (5 - 4); 113 X1 = (32 - 28 - 4 + 2) / 1; 114 X1 = 2; 93 115 94 116 *****************************************************************************/ … … 125 147 psPlaneTransform *out = psPlaneTransformAlloc(2, 2); 126 148 127 out->x->coeff[0][0] = -D + ((F*A)/C) / (E - ((F*B)/C));149 out->x->coeff[0][0] = (-D + ((F*A)/C)) / (E - ((F*B)/C)); 128 150 out->x->coeff[1][0] = -(F/C) / (E - ((F*B)/C)); 129 151 out->x->coeff[0][1] = 1.0 / (E - ((F*B)/C)); 130 out->y->coeff[0][0] = -D + ((E*A)/B) / (F - ((C*E)/B));152 out->y->coeff[0][0] = (-D + ((E*A)/B)) / (F - ((C*E)/B)); 131 153 out->y->coeff[1][0] = -(E/B) / (F - ((C*E)/B)); 132 154 out->y->coeff[0][1] = 1.0 / (F - ((C*E)/B)); … … 1140 1162 // 1141 1163 if (p_psIsProjectionLinear((psPlaneTransform *) in)) { 1142 printf("COOL: is linear\n");1143 1164 return(p_psPlaneTransformLinearInvert((psPlaneTransform *) in)); 1144 1165 } -
trunk/psLib/src/dataManip/psFunctions.c
r3709 r3714 7 7 * polynomials. It also contains a Gaussian functions. 8 8 * 9 * @version $Revision: 1.9 7$ $Name: not supported by cvs2svn $10 * @date $Date: 2005-04-19 0 0:34:04$9 * @version $Revision: 1.98 $ $Name: not supported by cvs2svn $ 10 * @date $Date: 2005-04-19 04:16:02 $ 11 11 * 12 12 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii 13 13 * 14 * XXX: What happens if the polyE Val functions are called with data of the wrong14 * XXX: What happens if the polyEval functions are called with data of the wrong 15 15 * type? 16 16 * XXX: Should the "coeffErr[]" be used as well? Bug ???. Ignore coeffErr 17 17 * 18 * XXX: In the various polyAlloc(n) functions, n is really the order of the 19 * polynomial plus 1. To create a 2nd-order polynomial, n == 3. 18 20 */ 19 21 /*****************************************************************************/ … … 175 177 static void dPolynomial2DFree(psDPolynomial2D* myPoly) 176 178 { 177 psS32 x = 0;178 179 for ( x = 0; x < myPoly->nX; x++) {179 //printf("dPolynomial2DFree(): HMMM: myPoly->nX is %d\n", myPoly->nX); 180 //printf("dPolynomial2DFree(): HMMM: myPoly->nY is %d\n", myPoly->nY); 181 for (psS32 x = 0; x < myPoly->nX; x++) { 180 182 psFree(myPoly->coeff[x]); 181 183 psFree(myPoly->coeffErr[x]); -
trunk/psLib/src/image/psImageStats.c
r3684 r3714 9 9 * @author GLG, MHPCC 10 10 * 11 * @version $Revision: 1.7 1$ $Name: not supported by cvs2svn $12 * @date $Date: 2005-04- 08 17:58:57$11 * @version $Revision: 1.72 $ $Name: not supported by cvs2svn $ 12 * @date $Date: 2005-04-19 04:16:02 $ 13 13 * 14 14 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 40 40 41 41 XXX: use static psVectors 42 43 XXX: optimize this. 2k vs 4k, sample mean, takes8 seconds on Gene's machine. 44 Should take .2. 42 45 *****************************************************************************/ 43 46 psStats* psImageStats(psStats* stats, -
trunk/psLib/src/imageops/psImageStats.c
r3684 r3714 9 9 * @author GLG, MHPCC 10 10 * 11 * @version $Revision: 1.7 1$ $Name: not supported by cvs2svn $12 * @date $Date: 2005-04- 08 17:58:57$11 * @version $Revision: 1.72 $ $Name: not supported by cvs2svn $ 12 * @date $Date: 2005-04-19 04:16:02 $ 13 13 * 14 14 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 40 40 41 41 XXX: use static psVectors 42 43 XXX: optimize this. 2k vs 4k, sample mean, takes8 seconds on Gene's machine. 44 Should take .2. 42 45 *****************************************************************************/ 43 46 psStats* psImageStats(psStats* stats, -
trunk/psLib/src/math/psPolynomial.c
r3709 r3714 7 7 * polynomials. It also contains a Gaussian functions. 8 8 * 9 * @version $Revision: 1.9 7$ $Name: not supported by cvs2svn $10 * @date $Date: 2005-04-19 0 0:34:04$9 * @version $Revision: 1.98 $ $Name: not supported by cvs2svn $ 10 * @date $Date: 2005-04-19 04:16:02 $ 11 11 * 12 12 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii 13 13 * 14 * XXX: What happens if the polyE Val functions are called with data of the wrong14 * XXX: What happens if the polyEval functions are called with data of the wrong 15 15 * type? 16 16 * XXX: Should the "coeffErr[]" be used as well? Bug ???. Ignore coeffErr 17 17 * 18 * XXX: In the various polyAlloc(n) functions, n is really the order of the 19 * polynomial plus 1. To create a 2nd-order polynomial, n == 3. 18 20 */ 19 21 /*****************************************************************************/ … … 175 177 static void dPolynomial2DFree(psDPolynomial2D* myPoly) 176 178 { 177 psS32 x = 0;178 179 for ( x = 0; x < myPoly->nX; x++) {179 //printf("dPolynomial2DFree(): HMMM: myPoly->nX is %d\n", myPoly->nX); 180 //printf("dPolynomial2DFree(): HMMM: myPoly->nY is %d\n", myPoly->nY); 181 for (psS32 x = 0; x < myPoly->nX; x++) { 180 182 psFree(myPoly->coeff[x]); 181 183 psFree(myPoly->coeffErr[x]); -
trunk/psLib/src/math/psSpline.c
r3709 r3714 7 7 * polynomials. It also contains a Gaussian functions. 8 8 * 9 * @version $Revision: 1.9 7$ $Name: not supported by cvs2svn $10 * @date $Date: 2005-04-19 0 0:34:04$9 * @version $Revision: 1.98 $ $Name: not supported by cvs2svn $ 10 * @date $Date: 2005-04-19 04:16:02 $ 11 11 * 12 12 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii 13 13 * 14 * XXX: What happens if the polyE Val functions are called with data of the wrong14 * XXX: What happens if the polyEval functions are called with data of the wrong 15 15 * type? 16 16 * XXX: Should the "coeffErr[]" be used as well? Bug ???. Ignore coeffErr 17 17 * 18 * XXX: In the various polyAlloc(n) functions, n is really the order of the 19 * polynomial plus 1. To create a 2nd-order polynomial, n == 3. 18 20 */ 19 21 /*****************************************************************************/ … … 175 177 static void dPolynomial2DFree(psDPolynomial2D* myPoly) 176 178 { 177 psS32 x = 0;178 179 for ( x = 0; x < myPoly->nX; x++) {179 //printf("dPolynomial2DFree(): HMMM: myPoly->nX is %d\n", myPoly->nX); 180 //printf("dPolynomial2DFree(): HMMM: myPoly->nY is %d\n", myPoly->nY); 181 for (psS32 x = 0; x < myPoly->nX; x++) { 180 182 psFree(myPoly->coeff[x]); 181 183 psFree(myPoly->coeffErr[x]); -
trunk/psLib/test/astronomy/tst_psAstrometry01.c
r3710 r3714 5 5 * @author GLG, MHPCC 6 6 * 7 * @version $Revision: 1.2 1$ $Name: not supported by cvs2svn $8 * @date $Date: 2005-04-19 0 1:22:23$7 * @version $Revision: 1.22 $ $Name: not supported by cvs2svn $ 8 * @date $Date: 2005-04-19 04:16:02 $ 9 9 * 10 10 * XXX: Must test … … 828 828 829 829 /****************************************************************************** 830 XXX: This is only a rudimentary test of the psPlaneTransform ()830 XXX: This is only a rudimentary test of the psPlaneTransformInvert() 831 831 function. It tests a few NULL input parameter conditions. 832 832 … … 844 844 // 845 845 trans->x->coeff[0][0] = 1.0; 846 trans->x->coeff[0][1] = 1.0;847 trans->x->coeff[1][0] = 1.0;846 trans->x->coeff[0][1] = 3.0; 847 trans->x->coeff[1][0] = 2.0; 848 848 trans->x->coeff[1][1] = 1.0; 849 trans->y->coeff[0][0] = 1.0;850 trans->y->coeff[0][1] = 1.0;851 trans->y->coeff[1][0] = 1.0;849 trans->y->coeff[0][0] = 4.0; 850 trans->y->coeff[0][1] = 6.0; 851 trans->y->coeff[1][0] = 5.0; 852 852 trans->y->coeff[1][1] = 1.0; 853 853 … … 878 878 } 879 879 880 printf("----------------------------------------------------------------------------------\n"); 881 printf("Calling psPlaneTransformInvert with acceptable data.\n"); 882 transOut = psPlaneTransformInvert(NULL, trans, myRegion, 10); 883 if (transOut == NULL) { 884 printf("TEST ERROR: psPlaneTransformInvert() returned a NULL psPlaneTransform.\n"); 885 testStatus = false; 880 printf("Calling psPlaneTransformInvert with an acceptable linear transformation.\n"); 881 for (psS32 n = 0 ; n < 100 ; n++) { 882 // 883 // We create a random linear transformation and hope it is invertible. 884 // 885 trans->x->coeff[0][0] = ((psF32) (random() % 1000000)) / 100000.0; 886 trans->x->coeff[0][1] = ((psF32) (random() % 1000000)) / 100000.0; 887 trans->x->coeff[1][0] = ((psF32) (random() % 1000000)) / 100000.0; 888 trans->x->coeff[1][1] = 0.1; 889 trans->y->coeff[0][0] = ((psF32) (random() % 1000000)) / 100000.0; 890 trans->y->coeff[0][1] = ((psF32) (random() % 1000000)) / 100000.0; 891 trans->y->coeff[1][0] = ((psF32) (random() % 1000000)) / 100000.0; 892 trans->y->coeff[1][1] = 0.1; 893 894 transOut = psPlaneTransformInvert(NULL, trans, myRegion, 10); 895 if (transOut == NULL) { 896 printf("TEST ERROR: psPlaneTransformInvert() returned a NULL psPlaneTransform.\n"); 897 testStatus = false; 898 } 899 psPlane *in = psPlaneAlloc(); 900 in->x = 2.0; 901 in->y = 3.0; 902 903 psPlane *mid = psPlaneTransformApply(NULL, trans, in); 904 psPlane *out = psPlaneTransformApply(NULL, transOut, mid); 905 906 if (((fabs(in->x - out->x) > FLT_EPSILON)) || 907 ((fabs(in->y - out->y) > FLT_EPSILON))) { 908 printf("TEST ERROR: in coords were (%f, %f), out coords were (%f, %f).\n", 909 in->x, in->y, out->x, out->y); 910 testStatus = false; 911 } 912 913 psFree(in); 914 psFree(mid); 915 psFree(out); 916 psFree(transOut); 886 917 } 887 918 888 919 psFree(trans); 889 psFree(transOut);890 920 psFree(myRegion); 891 921 892 922 return(!testStatus); 893 923 } 924 //This code will -
trunk/psLib/test/image/Makefile.am
r3684 r3714 20 20 tst_psImageManip \ 21 21 tst_psImageStats \ 22 tst_psImageStatsSpeed \ 22 23 tst_psImageExtraction \ 23 24 tst_psImageConvolve \ … … 43 44 tst_psImageManip_SOURCES = tst_psImageManip.c 44 45 tst_psImageStats_SOURCES = tst_psImageStats.c 46 tst_psImageStatsSpeed_SOURCES = tst_psImageStatsSpeed.c 45 47 tst_psImageExtraction_SOURCES = tst_psImageExtraction.c 46 48 tst_psImageConvolve_SOURCES = tst_psImageConvolve.c
Note:
See TracChangeset
for help on using the changeset viewer.
