andfanilo / streamlit-drawable-canvas

Do you like Quick, Draw? Well what if you could train/predict doodles drawn inside Streamlit? Also draws lines, circles and boxes over background images for annotation.
https://drawable-canvas.streamlit.app/
MIT License
563 stars 85 forks source link

how to obtain the center when drawing a circle #32

Closed longswordinhand closed 3 years ago

longswordinhand commented 3 years ago

Is the (left, top) the left-top point of the circle? I found there is an offset if I use it. Thanks.

andfanilo commented 3 years ago

Hey @longswordinhand,

You can refer to this answer: https://github.com/andfanilo/streamlit-drawable-canvas/issues/15#issuecomment-687751606

center_x = left + radius * math.cos(angle * math.pi / 180)
center_y = top + radius * math.sin(angle * math.pi / 180)