MAINT: bezier_segment is private

This commit is contained in:
François Boulogne
2013-08-27 16:39:55 +02:00
parent 1a0f137679
commit a4f1704d6e
3 changed files with 10 additions and 10 deletions
+1 -1
View File
@@ -2,7 +2,7 @@ from .draw import circle, ellipse, set_color
from .draw3d import ellipsoid, ellipsoid_stats
from ._draw import (line, line_aa, polygon, ellipse_perimeter,
circle_perimeter, circle_perimeter_aa,
bezier_segment)
_bezier_segment)
__all__ = ['line',
'line_aa',
+6 -6
View File
@@ -533,23 +533,23 @@ def ellipse_perimeter(Py_ssize_t cy, Py_ssize_t cx, Py_ssize_t yradius,
iyd = int(floor(ya * w + 0.5))
# Draw the 4 quadrants
rr, cc = bezier_segment(iy0 + iyd, ix0, iy0, ix0, iy0, ix0 + ixd, 1-w)
rr, cc = _bezier_segment(iy0 + iyd, ix0, iy0, ix0, iy0, ix0 + ixd, 1-w)
py.extend(rr)
px.extend(cc)
rr, cc = bezier_segment(iy0 + iyd, ix0, iy1, ix0, iy1, ix1 - ixd, w)
rr, cc = _bezier_segment(iy0 + iyd, ix0, iy1, ix0, iy1, ix1 - ixd, w)
py.extend(rr)
px.extend(cc)
rr, cc = bezier_segment(iy1 - iyd, ix1, iy1, ix1, iy1, ix1 - ixd, 1-w)
rr, cc = _bezier_segment(iy1 - iyd, ix1, iy1, ix1, iy1, ix1 - ixd, 1-w)
py.extend(rr)
px.extend(cc)
rr, cc = bezier_segment(iy1 - iyd, ix1, iy0, ix1, iy0, ix0 + ixd, w)
rr, cc = _bezier_segment(iy1 - iyd, ix1, iy0, ix1, iy0, ix0 + ixd, w)
py.extend(rr)
px.extend(cc)
return np.array(py, dtype=np.intp), np.array(px, dtype=np.intp)
def bezier_segment(Py_ssize_t y0, Py_ssize_t x0,
def _bezier_segment(Py_ssize_t y0, Py_ssize_t x0,
Py_ssize_t y1, Py_ssize_t x1,
Py_ssize_t y2, Py_ssize_t x2,
double weight):
@@ -643,7 +643,7 @@ def bezier_segment(Py_ssize_t y0, Py_ssize_t x0,
sy = floor((y0 + 2 * weight * y1 + y2) * xy * 0.5 + 0.5)
dx = floor((weight * x1 + x0) * xy + 0.5)
dy = floor((y1 * weight + y0) * xy + 0.5)
return bezier_segment(y0, x0, <Py_ssize_t>(dy), <Py_ssize_t>(dx),
return _bezier_segment(y0, x0, <Py_ssize_t>(dy), <Py_ssize_t>(dx),
<Py_ssize_t>(sy), <Py_ssize_t>(sx), cur)
err = dx + dy - xy
+3 -3
View File
@@ -5,7 +5,7 @@ from skimage.draw import (line, line_aa,
polygon, circle,
circle_perimeter, circle_perimeter_aa,
ellipse,
ellipse_perimeter, bezier_segment,
ellipse_perimeter, _bezier_segment,
)
@@ -433,7 +433,7 @@ def test_bezier_segment_straight():
y1 = 50
x2 = 150
y2 = 150
rr, cc = bezier_segment(x0, y0, x1, y1, x2, y2, 0)
rr, cc = _bezier_segment(x0, y0, x1, y1, x2, y2, 0)
image [rr, cc] = 1
image2 = np.zeros((200, 200), dtype=int)
@@ -444,7 +444,7 @@ def test_bezier_segment_straight():
def test_bezier_segment_curved():
img = np.zeros((25, 25), 'uint8')
rr, cc = bezier_segment(20, 20, 20, 2, 2, 2, 1)
rr, cc = _bezier_segment(20, 20, 20, 2, 2, 2, 1)
img[rr, cc] = 1
img_ = np.array(
[[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],