draco1023 / aforge

Automatically exported from code.google.com/p/aforge
Other
0 stars 0 forks source link

Off-by-one error in PointsCloud.GetCenterOfGravity #143

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
In PointsCloud.GetCenterOfGravity, at PointsCloud.cs:112, the for loop starts 
at i=1, skipping the first point in the cloud, and biasing the center of 
gravity toward (0,0).

The most obvious test case is a cloud containing only one (non-(0,0)) point; 
CenterOfGravity will always return (0,0).

This was observed in both 2.1.3 and current svn HEAD (r1292).

Original issue reported on code.google.com by dales...@gmail.com on 2 Aug 2010 at 6:29

GoogleCodeExporter commented 9 years ago
Fixed. It seems it was supposed to initialize xSum and ySum with value of the 
first point, but it was missed. Just made for-loop starting from 0.

Committed in revision 1293. Will be released in 2.1.4.

Original comment by andrew.k...@gmail.com on 3 Aug 2010 at 10:23

GoogleCodeExporter commented 9 years ago

Original comment by andrew.k...@gmail.com on 1 Sep 2010 at 7:02