clygon
Clygon is a library built to calculate everything from circles to polygons. You can calculate the interior angles of a polygon, or the area of any n-gon, and even the arc length, radius, or central angle of a circle.
To install the package, run pip install clygon==0.0.5 in your terminal or cmd prompt.
How can I use it?
- Import the library:
from clygon.shapes import Polygon, Circle
- Instantiate the class:
eleven = Polygon(sides=11)
- Perform your calculations/attributes:
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))
- Run the code!
Example usage for polygons:
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())
Output:
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
Example usage for circles:
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())
Output:
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
Metadata
Release files for clygon 0.0.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| clygon-0.0.5.tar.gz | 4.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| clygon-0.0.5-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 9.9 kB
Release files / clygon-0.0.5.tar.gz
| Download URL | clygon-0.0.5.tar.gz |
|---|---|
| Size | 4.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
4af318079f6f08c394dc8d387d2818a0307cf917d2c99a6711578221b478c1d8
|
|
BLAKE2b-256 checksum How to use checksums |
3edc3616cbe4a084cd86a8b9a3e5f977ba6066be3cfdaf9df964ef1a58a4204b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.1 importlib_metadata/3.10.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.8.3
|
Release files / clygon-0.0.5-py3-none-any.whl
| Download URL | clygon-0.0.5-py3-none-any.whl |
|---|---|
| Size | 5.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
78ef29d3b26057d90f1770716828960f5484d4f9f4206276d09934556a8ea4b1
|
|
BLAKE2b-256 checksum How to use checksums |
c48939e71ae87701c804ee388e24d91def96d692dda383999152c6145c488c54
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.1 importlib_metadata/3.10.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.8.3
|