This article is made by Jason-Cow.Welcome to reprint.But please post the article's address.
关键一句话
Cross(A[m-1]-R[i],A[m]-R[i])<=0)m--
附加,极角排序,课上讲~~
1 D O; 2 bl acomp(D A,D B){ 3 db x=Cross(A-O,B-O); 4 if(x>0)return 1;if(x<0)return 0; 5 return Dis(O,A)1 && Cross(A[m-1]-R[i],A[m]-R[i])<=0)m--;15 A[++m]=R[i];16 }17 return m;18 }
学了Andrew后,觉得Graham好丑,而且常数还大
唯一的好处是好写,其实差不多