JOIN
 Select a Forum     Round Tables New Member Discussions News Discussions Algorithm Matches Marathon Matches NASA Tournament Lab TopCoder Cookbook High School Matches Sponsor Discussions Development Forums Design Forums Search | Watch Thread  |  My Post History  |  My Watches  |  User Settings View: Flat (newest first)  | Threaded  | Tree Previous Thread  |  Next Thread Forums Tutorial Discussions Geometry Concepts bug?
 bug? | Reply Hi, I think u have a little bug in your code that calculates the area of a polygon:int area = 0;int N = lengthof(p);//We will triangulate the polygon//into triangles with points p[0],p[i],p[i+1]for(int i = 1; i+1
 Re: bug? (response to post by axelmoser) | Reply yeah,I agree with you
 Re: bug? (response to post by axelmoser) | Reply This mistake remains :sreturn abs(cross/2.0);Should bereturn abs(area/2.0);
 Re: bug? (response to post by mogers) | Reply If I am going to make a function to calculate polygon area, I would left the return as area / 2.0. That way, the function also serves to identify if a polygon is defined clockwise or counterclockwise.
 Re: A slight mistake and a doubt (response to post by axelmoser) | Reply Hi I am sure many people must have noticed it, but there is a small mistake in the polygon area description. In the 4th line below the polygon figure it should be "the same as ABC+ACD" instead of "the same as ABC+ABD".Also, I found the desciption of the line segment joining (1,3) to (5,1) as (4,-2) (under the sub-heading "Vectors" at the beginning of the article) a bit confusing. Has it been represented simply as (x2-x1,y2-y1)? Or is it something else?