# How to draw a perfect circle?

## Description

8.3.9

### What I want to…

I want to draw a perfect circle including :

• the center point : `lv_point_t point = {100,100}`

• the radius: `int radius = 50`

• the line width: `int line_width = 2`

Unfortunately, I found that LVGL does not provide a direct interface for drawing circles. I have also tried using the `arc` to achieve a similar function, but the result was not satisfactory.

So what should I do to achieve this in detail?

Just create an empty lv_obj. Set its position (100, 100) and size (50?).

Give it a background color/opacity and set its `RADIUS` style property to either `50` or `LV_RADIUS_CIRCLE`.

EDIT: just realized you wanted to create a circl with just a line around it. Create an object of size 50, set the radius style property, set background opacity to 0 and then set the border with to 2 and color to whatever you want. See the documentation on styles:

https://docs.lvgl.io/8.4/overview/coords.html#using-styles

1 Like

I sincerely appreciate your prompt and effective solution. As a beginner in LVGL programming, I am very grateful for your timely response and assistance in resolving my issues. Thank you very much!

If you like to be more adventurous, you can use trigonometry too

x1 = x + r * Cos (θ)
y1 = y + r * Sin (θ)

where

• angle θ, goes from 0 deg to 360 degree converted to radian.
• radian θ = deg θ * (3.14 / 180.0)
• r is the radius of the circle

Yeah! I know that. Just don’t want to build from scratch, (because I’m so lazy…

No matter what, I’m still very thankful to you, man.