A simple package for working with basic geometry shapes
Project description
A simple python package for geometrical operations.
import geometry_box as gb
circle = gb.Circle(radius=2.0, cent=(3.0, 6.0))
print(circle.area) # prints circle area
print(circle.perimeter) # prints circle perimeter
circle.shape_factor() # returns shape factor: perimeter/equivalent circle perimeter.
circle.eval_locus(num_points=50) # finds 50 points along the periphery of circle
circle.eval_locus(num_points=250).plot() # plots a circle displays using `matplotlib.pyplot.show()`
circle.eval_locus().plot(f_path='/path/to/file') # saves a plot at the specified path
#
import matplotlib.pyplot as plt
fig, axs = plt.subplots()
circle.eval_locus().plot(axis=axs) # plots circle on the axs object
A sample code for plotting various shapes
import geometry_box as gb
from os import path
import matplotlib.pyplot as plt
fig, axs = plt.subplots(2, 4)
gb.Circle().eval_locus().plot(axis=axs[0, 0])
gb.Ellipse().eval_locus().plot(axis=axs[0, 1])
gb.RegularPolygon(3).eval_locus().plot(axis=axs[0, 2])
gb.Rectangle().eval_locus().plot(axis=axs[0, 3])
gb.BoundingBox2D().eval_locus().plot(axis=axs[1, 0])
gb.CShape().eval_locus().plot(axis=axs[1, 1])
gb.Capsule().eval_locus().plot(axis=axs[1, 2])
gb.NLobeShape(3).eval_locus().plot(axis=axs[1, 3])
plt.tight_layout()
plt.savefig(path.join(path.dirname(__file__), "shapes.pdf"))
plt.close()
It produces the following figure
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
geometry_box-0.1.2.tar.gz
(9.1 kB
view details)
File details
Details for the file geometry_box-0.1.2.tar.gz.
File metadata
- Download URL: geometry_box-0.1.2.tar.gz
- Upload date:
- Size: 9.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ac11bced9973cc3ddcf9703eea4df2cff5d0fb30d6bc82dd4c6df79ea5fb7deb
|
|
| MD5 |
afdd92e9b22b2aa9a7b8be63bdcf2479
|
|
| BLAKE2b-256 |
b6b7e3c95612109e17fd3556f51a68622c1e7bfe603d16ac2f3633d7a953e77e
|