Search code examples
python-3.xmathscikit-image

Trying to create an arc in scikit-image comes out wrong


I am trying to create an arc based on the following information:

  • radius
  • x1,y1 and x2,y2 points on the circumference of a circle.

xy co-ordinates are defined as:

x = radius * cos(angle) + center_x
y = radius * sin(angle) + center_y

I've tried using line, line_aa and bezier. The latter I got the midway angle of x1,y1 to x2,y2. But the results not what I would expect.


Solution

  • The issue is I am using angle but cos() and sin() use radians. This can be fixed with:

    r = radians(angle)
    x = radius * cos(r) + center_x
    y = radius * sin(r) + center_y