Skip to content

Commit e21bd24

Browse files
authored
Merge pull request #851 from compas-dev/bestfit_circle_redux
Avoid stable points
2 parents 3db1437 + ec2e313 commit e21bd24

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
2121

2222
* Allow str or int as joint type in `compas.robots.Joint` constructor.
2323
* `compas_ghpython.artists.FrameArtist.draw` now draws a Rhino Plane.
24+
* Fixed bugs in `compas.geometry.bestfit_circle_numpy`.
2425
* Changed directory where ghuser components are installed.
2526
* Added ghuser components directory to those removed by the `clean` task.
26-
* Fixed bug in `compas.geometry.bestfit_circle_numpy`.
2727

2828
### Removed
2929

src/compas/geometry/bestfit/bestfit_numpy.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
from numpy import asarray
66
from numpy import sqrt
7-
from numpy import mean
87
from numpy import zeros
98
from numpy.linalg import lstsq
109
from scipy.optimize import leastsq
@@ -122,8 +121,10 @@ def f(c):
122121
Ri = dist(*c)
123122
return Ri - Ri.mean()
124123

125-
xm = mean(x)
126-
ym = mean(y)
124+
# The mean of x and y are very nearly 0 (1.0e-15), which reveals a numerical
125+
# instability of the problem. So, we choose our initial guess
126+
# to be an epsilon bigger than that.
127+
xm = ym = 0.00001
127128
c0 = xm, ym
128129
c, error = leastsq(f, c0)
129130

0 commit comments

Comments
 (0)