- A regular n-gon is a polygon with all sides and angles equal. It can have both a circumscribed circle (circumcircle) and an inscribed circle (incircle).
- The circumcircle passes through all vertices of the n-gon.
- The incircle is tangent to all sides of the n-gon.
-
These formulas are useful for understanding the geometric properties of regular polygons and have applications in various fields.
-
이 코드는 다음과 같은 기능을 수행합니다:
-
calculate_radii
함수는 주어진 한 변의 길이 ( s )와 변의 수 ( n )을 이용하여 외접원 반지름 ( R )과 내접원 반지름 ( r )을 계산합니다.
-
plot_polygon_and_circles
함수는 계산된 반지름을 사용하여 정다각형과 그 외접원 및 내접원을 시각화합니다.matplotlib
라이브러리를 활용하여 도형을 그립니다.
-
- 사용자로부터 한 변의 길이 ( s )와 변의 수 ( n )을 입력받습니다. ( n )이 3 이상의 정수인지 확인한 후, 조건에 맞으면 도형을 그립니다.
-
-
이 코드를 실행하면, 입력한 값에 따라 정다각형과 그 외접원 및 내접원이 시각적으로 표시됩니다.