diff options
| author | Lex Neva <lexelby@users.noreply.github.com> | 2023-04-13 20:27:20 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-04-13 20:27:20 -0400 |
| commit | c59af0e8f44a1996799ccf83b78b340507bbd062 (patch) | |
| tree | 05738463cd5eed07146273e8fc94e69df77e7300 /lib/utils | |
| parent | 6273393b908ddbc891afc719bc8a3d42c2560b1f (diff) | |
| parent | 63effb841fa3ea507135e10331b8ecb1a64e94dd (diff) | |
Merge pull request #2190 from inkstitch/lexelby/meander-fixes
meander fixes
Diffstat (limited to 'lib/utils')
| -rw-r--r-- | lib/utils/smoothing.py | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/utils/smoothing.py b/lib/utils/smoothing.py index 9d43a9f1..1bb250c5 100644 --- a/lib/utils/smoothing.py +++ b/lib/utils/smoothing.py @@ -70,7 +70,8 @@ def smooth_path(path, smoothness=1.0): # .T transposes the array (for some reason splprep expects # [[x1, x2, ...], [y1, y2, ...]] - tck, fp, ier, msg = splprep(coords.T, s=s, k=3, nest=-1, full_output=1) + with debug.time_this("splprep"): + tck, fp, ier, msg = splprep(coords.T, s=s, k=3, nest=-1, full_output=1) if ier > 0: debug.log(f"error {ier} smoothing path: {msg}") return path @@ -78,7 +79,8 @@ def smooth_path(path, smoothness=1.0): # Evaluate the spline curve at many points along its length to produce the # smoothed point list. 2 * num_points seems to be a good number, but it # does produce a lot of points. - smoothed_x_values, smoothed_y_values = splev(np.linspace(0, 1, int(num_points * 2)), tck[0]) - coords = np.array([smoothed_x_values, smoothed_y_values]).T + with debug.time_this("splev"): + smoothed_x_values, smoothed_y_values = splev(np.linspace(0, 1, int(num_points * 2)), tck[0]) + coords = np.array([smoothed_x_values, smoothed_y_values]).T return [Point(x, y) for x, y in coords] |
