Skip to content

Application software in Python 3 to create circle packing in closed polygons.

License

Notifications You must be signed in to change notification settings

aarizat/circpacker

Repository files navigation

circpacker : Circle Packer

made-with-python docs License orcid

CircPacker is an application software in Python 3 to create circle packing in closed polygons.

plot example1

Features

Requirements

The code was written in Python 3. The packages numpy, scipy, matplotlib and triangle are required for using circpacker. All of them are downloadable from the PyPI repository by opening a terminal and typing the following code lines:

pip install numpy
pip install scipy
pip install matplotlib
pip install triangle

Installation

To install circpacker open a terminal and type:

pip install circpacker

Examples

To produce the plot shown above execute the following script

from numpy import array
from circpacker.basegeom import Polygon
from circpacker.packer import CircPacking as cp
coordinates = array([[1, 1], [2, 5], [4.5, 6], [8, 3], [7, 1],
                     [4, 0]])
polygon = Polygon(coordinates)
boundCoords = polygon.boundCoords
CircPack = cp(boundCoords, depth=10)
CircPack.plot(plotTriMesh=True)

Now, let's see an example for a autosimilar bimsoil model.

from numpy import array
import matplotlib.pyplot as plt
from circpacker.basegeom import Polygon
from circpacker.packer import CircPacking as cp
from circpacker.slopegeometry import AnthropicSlope

h = 15 # slope height
slopeGeometry = AnthropicSlope(h, [1, 1.5], 2/3*h, 2/3*h, 1/3*h)
boundCoords = slopeGeometry.boundCoords
polygon = Polygon(boundCoords)
CircPack = cp(boundCoords, minAngle=20, maxArea=0.35*polygon.area, length=0.05*h)
CircPack.plot(plotTriMesh=True)

For a simple slope with h=15 m, inclination H:V of 1:1.5, crown and foot lengths of 2/3h, and depth 1/3h. Minimum angle and maximum area for each Delaunay triangle of 20° and 35% of slope area, respectively.

plot example2

More information

Here is a list of papers based on circpacker.

About

Application software in Python 3 to create circle packing in closed polygons.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published