Changeset 3714 for trunk/psLib/test/astronomy
- Timestamp:
- Apr 18, 2005, 6:16:02 PM (21 years ago)
- File:
-
- 1 edited
-
trunk/psLib/test/astronomy/tst_psAstrometry01.c (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
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
Note:
See TracChangeset
for help on using the changeset viewer.
