|
259 | 259 | " \"\"\"Generate points defining a circle on an image.\"\"\"\n",
|
260 | 260 | " radians = np.linspace(0, 2*np.pi, resolution)\n",
|
261 | 261 | "\n",
|
262 |
| - " c = center[1] + radius*np.cos(radians)\n", |
263 | 262 | " r = center[0] + radius*np.sin(radians)\n",
|
| 263 | + " c = center[1] + radius*np.cos(radians)\n", |
264 | 264 | " \n",
|
265 |
| - " return np.array([c, r]).T\n", |
| 265 | + " return np.array([r, c]).T\n", |
266 | 266 | "\n",
|
267 | 267 | "# Exclude last point because a closed path should not have duplicate points\n",
|
268 |
| - "points = circle_points(200, [100, 220], 100)[:-1]" |
| 268 | + "points = circle_points(resolution=200, center=[100, 220], radius=100)[:-1]" |
269 | 269 | ]
|
270 | 270 | },
|
271 | 271 | {
|
|
284 | 284 | "outputs": [],
|
285 | 285 | "source": [
|
286 | 286 | "fig, ax = image_show(astronaut)\n",
|
287 |
| - "ax.plot(points[:, 0], points[:, 1], '--r', lw=3)\n", |
288 |
| - "ax.plot(snake[:, 0], snake[:, 1], '-b', lw=3);" |
| 287 | + "ax.plot(points[:, 1], points[:, 0], '--r', lw=3)\n", |
| 288 | + "ax.plot(snake[:, 1], snake[:, 0], '-b', lw=3);" |
289 | 289 | ]
|
290 | 290 | },
|
291 | 291 | {
|
|
0 commit comments