Changeset 9fbf02 in git for factory/facFqBivarUtil.cc
- Timestamp:
- Jan 6, 2014, 11:42:51 PM (10 years ago)
- Branches:
- (u'spielwiese', 'e7cc1ebecb61be8b9ca6c18016352af89940b21a')
- Children:
- 49ba0963eace9d5fafa517dc5e9b39eb0ed0a096
- Parents:
- f63d2e83242d64e2f8e687d91e9ab3ddabad5ac0
- git-author:
- Martin Lee <martinlee84@web.de>2014-01-06 23:42:51+01:00
- git-committer:
- Martin Lee <martinlee84@web.de>2014-01-20 16:45:04+01:00
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
factory/facFqBivarUtil.cc
rf63d2e8 r9fbf02 788 788 } 789 789 int k= 0; 790 int* point= new int [2]; 790 791 for (int i= 0; i < n; i++) 791 792 { … … 834 835 continue; 835 836 } 836 int* point= new int [2];837 837 point [0]= k; 838 838 point [1]= i + 1; … … 840 840 k= 0; 841 841 result [i]= k; 842 delete [] point; 843 } 842 } 843 844 delete [] point; 844 845 845 846 for (int i= 0; i < sizeOfNewtonPolygon; i++) … … 894 895 } 895 896 897 int swap; 898 for (int i= 0; i < sizeOfNewtonPolygon; i++) 899 { 900 swap= newtonPolyg[i][1]; 901 newtonPolyg[i][1]=newtonPolyg[i][0]; 902 newtonPolyg[i][0]= swap; 903 } 904 905 sizeOfNewtonPolygon= polygon(newtonPolyg, sizeOfNewtonPolygon); 906 896 907 int minX, minY, maxX, maxY; 897 908 minX= newtonPolyg [0] [0]; … … 902 913 for (int i= 1; i < sizeOfNewtonPolygon; i++) 903 914 { 904 if (newtonPolyg[i][ 0] == 0)905 { 906 if (newtonPolyg[indZero][ 0] == 0)907 { 908 if (newtonPolyg[indZero][ 1] < newtonPolyg[i][1])915 if (newtonPolyg[i][1] == 0) 916 { 917 if (newtonPolyg[indZero][1] == 0) 918 { 919 if (newtonPolyg[indZero][0] < newtonPolyg[i][0]) 909 920 indZero= i; 910 921 } … … 926 937 if (indZero != sizeOfNewtonPolygon - 1) 927 938 { 928 slopeNum= newtonPolyg[indZero+1][ 1]-newtonPolyg[indZero][1];929 slopeDen= newtonPolyg[indZero+1][ 0];930 constTerm= newtonPolyg[indZero][ 1];939 slopeNum= newtonPolyg[indZero+1][0]-newtonPolyg[indZero][0]; 940 slopeDen= newtonPolyg[indZero+1][1]; 941 constTerm= newtonPolyg[indZero][0]; 931 942 } 932 943 else 933 944 { 934 slopeNum= newtonPolyg[0][ 1]-newtonPolyg[indZero][1];935 slopeDen= newtonPolyg[0][ 0];936 constTerm= newtonPolyg[indZero][ 1];945 slopeNum= newtonPolyg[0][0]-newtonPolyg[indZero][0]; 946 slopeDen= newtonPolyg[0][1]; 947 constTerm= newtonPolyg[indZero][0]; 937 948 } 938 949 if (slopeNum < 0) … … 942 953 } 943 954 int k= 0; 955 956 int* point= new int [2]; 944 957 for (int i= 0; i < n; i++) 945 958 { 946 if (((indZero+1) < sizeOfNewtonPolygon && (i+1) > newtonPolyg[indZero+1][ 0])947 || ((indZero+1) >= sizeOfNewtonPolygon && (i+1) > newtonPolyg[0][ 0]))959 if (((indZero+1) < sizeOfNewtonPolygon && (i+1) > newtonPolyg[indZero+1][1]) 960 || ((indZero+1) >= sizeOfNewtonPolygon && (i+1) > newtonPolyg[0][1])) 948 961 { 949 962 if (indZero + 1 != sizeOfNewtonPolygon) … … 953 966 if (indZero != sizeOfNewtonPolygon - 1) 954 967 { 955 slopeNum= newtonPolyg[indZero+1][ 1]-newtonPolyg[indZero][1];956 slopeDen= newtonPolyg[indZero+1][ 0]-newtonPolyg[indZero][0];957 constTerm= newtonPolyg[indZero][ 1];968 slopeNum= newtonPolyg[indZero+1][0]-newtonPolyg[indZero][0]; 969 slopeDen= newtonPolyg[indZero+1][1]-newtonPolyg[indZero][1]; 970 constTerm= newtonPolyg[indZero][0]; 958 971 } 959 972 else 960 973 { 961 slopeNum= newtonPolyg[0][ 1]-newtonPolyg[indZero][1];962 slopeDen= newtonPolyg[0][ 0]-newtonPolyg[indZero][0];963 constTerm= newtonPolyg[indZero][ 1];974 slopeNum= newtonPolyg[0][0]-newtonPolyg[indZero][0]; 975 slopeDen= newtonPolyg[0][1]-newtonPolyg[indZero][1]; 976 constTerm= newtonPolyg[indZero][0]; 964 977 } 965 978 if (slopeNum < 0) … … 967 980 negativeSlope= true; 968 981 slopeNum= - slopeNum; 969 k= (int) -(((long) slopeNum*((i+1)-newtonPolyg[indZero][ 0])+slopeDen-1)/982 k= (int) -(((long) slopeNum*((i+1)-newtonPolyg[indZero][1])+slopeDen-1)/ 970 983 slopeDen) + constTerm; 971 984 } 972 985 else 973 k= (int) (((long) slopeNum*((i+1)-newtonPolyg[indZero][ 0])) / slopeDen)986 k= (int) (((long) slopeNum*((i+1)-newtonPolyg[indZero][1])) / slopeDen) 974 987 + constTerm; 975 988 } … … 977 990 { 978 991 if (negativeSlope) 979 k= (int) -(((long) slopeNum*((i+1)-newtonPolyg[indZero][ 0])+slopeDen-1)/992 k= (int) -(((long) slopeNum*((i+1)-newtonPolyg[indZero][1])+slopeDen-1)/ 980 993 slopeDen) + constTerm; 981 994 else 982 k= (int) ((long) slopeNum*((i+1)-newtonPolyg[indZero][ 0])) / slopeDen995 k= (int) ((long) slopeNum*((i+1)-newtonPolyg[indZero][1])) / slopeDen 983 996 + constTerm; 984 997 } 985 if (i + 1 > max X || i + 1 < minX)998 if (i + 1 > maxY || i + 1 < minY) 986 999 { 987 1000 result [i]= 0; 988 1001 continue; 989 1002 } 990 int* point= new int [2]; 991 point [0]= i + 1;992 point [1]= k;1003 1004 point [0]= k; 1005 point [1]= i + 1; 993 1006 if (!isInPolygon (newtonPolyg, sizeOfNewtonPolygon, point) && k > 0) 994 1007 k= 0; 995 1008 result [i]= k; 996 delete [] point; 997 } 1009 } 1010 1011 delete [] point; 998 1012 999 1013 for (int i= 0; i < sizeOfNewtonPolygon; i++)
Note: See TracChangeset
for help on using the changeset viewer.