Skip to main content

A simple library to calculate anything and everything about circles and polygons.

Project description

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?

  1. Import the library:
from clygon.shapes import Polygon, Circle
  1. Instantiate the class:
eleven = Polygon(sides=11)
  1. 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))
  1. 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  

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

clygon-0.0.5.tar.gz (4.1 kB view details)

Uploaded Source

Built Distribution

clygon-0.0.5-py3-none-any.whl (5.9 kB view details)

Uploaded Python 3

File details

Details for the file clygon-0.0.5.tar.gz.

File metadata

  • Download URL: clygon-0.0.5.tar.gz
  • Upload date:
  • Size: 4.1 kB
  • Tags: Source
  • Uploaded using 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

File hashes

Hashes for clygon-0.0.5.tar.gz
Algorithm Hash digest
SHA256 4af318079f6f08c394dc8d387d2818a0307cf917d2c99a6711578221b478c1d8
MD5 b20984806e0c768e69f091e6b9f87515
BLAKE2b-256 3edc3616cbe4a084cd86a8b9a3e5f977ba6066be3cfdaf9df964ef1a58a4204b

See more details on using hashes here.

File details

Details for the file clygon-0.0.5-py3-none-any.whl.

File metadata

  • Download URL: clygon-0.0.5-py3-none-any.whl
  • Upload date:
  • Size: 5.9 kB
  • Tags: Python 3
  • Uploaded using 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

File hashes

Hashes for clygon-0.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 78ef29d3b26057d90f1770716828960f5484d4f9f4206276d09934556a8ea4b1
MD5 3b7e40de76ea6360fe2469e45225ff72
BLAKE2b-256 c48939e71ae87701c804ee388e24d91def96d692dda383999152c6145c488c54

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page