Skip to main content

一个简单的库来计算关于圆和多边形的任何东西。

项目描述

克莱贡

Clygon 是一个用于计算从圆形到多边形的所有内容的库。您可以计算多边形的内角,或任何 n 边形的面积,甚至可以计算圆的弧长、半径或圆心角。

要安装软件包,pip install clygon==0.0.5请在终端或 cmd 提示符下运行。

我该如何使用它?

  1. 导入库:
from clygon.shapes import Polygon, Circle
  1. 实例化类:
eleven = Polygon(sides=11)
  1. 执行您的计算/属性:
print("The shape is called:", eleven.name())
print("The sum of the interior angles is:", eleven.sum_of_interior_angles())
print(eleven.sum_of_interior_angles(exp=True))
print("

 The interior angles are", eleven.interior_angles())
print(eleven.interior_angles(exp=True))
  1. 运行代码!

多边形的示例用法:

from clygon.shapes import Polygon

eleven = Polygon(sides=11)
print("The shape is called:", eleven.name())
print("The sum of the interior angles is:", eleven.sum_of_interior_angles())
print(eleven.sum_of_interior_angles(exp=True))
print("

 The interior angles are", eleven.interior_angles())
print(eleven.interior_angles(exp=True))

fourtytwo = Polygon(sides=42)
print(fourtytwo.name())
print("if apothem=5, area =",fourtytwo.area(apothem=5))
print("if base=5, area =",fourtytwo.area(base=5))
print("if base=5, perimeter =",fourtytwo.perimeter(base=5))
print("ext. angles=",fourtytwo.exterior_angles())



输出:

The shape is called: Hendecagon
The sum of the interior angles is: 1620
The formula for the sum of interior angles is: 180(n-2) where n is the number of sides
180(11 - 2)
180(9)
1620


 The interior angles are 180.0
The formula for each individual interior angle is: 180(n-2)/n where n is the number of sides
180(11 - 2)/11
180(9)/11
1620/11 
147.27272727272728
42-gon
if apothem=5, area = 78.68662202004133
if base=5, area = 3502.819067894399
if base=5, perimeter = 210
ext. angles= 8.571428571428571

圆圈的示例用法:

from clygon.shapes import Circle, finder_form

circle = Circle(radius=8)
print("Area:", circle.area())
print("The area of some of the circle is:", circle.part_area(radius=8, central_angle=40))
print("The perimeter is:", circle.perimeter())
print("If the arc length is 50, the central angle is: ", circle.finder(arc_length=50, radius=8))
print("The formula to solve for the central angle is: ", finder_form())

输出:

Area: 201.06192982974676
The area of some of the circle is: 22.340214425527417
The perimeter is: 50.26548245743669
If the arc length is 50, the central angle is:  358.09862195676453
The formula to solve for the central angle is:  The formula is: Arc Length = (Central angle * π * Radius)/180  

项目详情


下载文件

下载适用于您平台的文件。如果您不确定要选择哪个,请了解有关安装包的更多信息。

源分布

clygon-0.0.5.tar.gz (4.1 kB 查看哈希)

已上传 source

内置分布

clygon-0.0.5-py3-none-any.whl (5.9 kB 查看哈希)

已上传 py3