2. packer

Module to define particular circular tangents in a closed polygon in \(\mathbb{R}^2\).

class packer.CircPacking(coordinates, minAngle=None, maxArea=None, length=None, depth=None)[source]

Bases: object

Creates an instance of an object that defines circular particles tangent in a fractal way inside of a closed polygon in \(\mathbb{R}^2\).

coordinates

Coordinates of vertices of the polygon.

Type:(n, 2) numpy.ndarray
depth

Depth fractal for each triangle that compose the triangular mesh. Large values of depth might produce internal variables that tend to infinite, then a ValueError is produced with a warning message array must not contain infs or            NaNs.

Type:int
minAngle

Minimum angle for each triangle of the Delaunay triangulation.

Type:int or float
maxArea

Maximum area for each triangle of the Delaunay triangulation.

Type:int or float
length

Characteristic length This variable is used to model bimsoils/bimrock. The default value is None.

Type:int or float

Note

The class CircPacking requires NumPy, Matplotlib and Triangle

Examples

>>> from numpy import array
>>> from circpacker.packer import CircPacking as cp
>>> coords = array([[1, 1], [2, 5], [4.5, 6], [8, 3], [7, 1], [4, 0]])
>>> pckCircles = cp(coords, depth=5)
>>> pckCircles.__dict__.keys()
dict_keys(['coordinates', 'minAngle', 'maxArea', 'lenght', 'depth',
           'CDT', 'listCirc'])
triMesh()[source]

Method to generate a triangles mesh in a polygon by using Constrained Delaunay triangulation.

Returns:Vertices of each triangle that compose the triangular mesh. n means the number of triangles; (3, 2) means the index vertices and the coordinates (x, y) respectively.
Return type:verts ((n, 3, 2) numpy.ndarray)

Examples

>>> 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], [6, 4], [8, 3],
                         [7, 1], [4.5, 1], [4, 0]])
>>> polygon = Polygon(coordinates)
>>> boundCoords = polygon.boundCoords
>>> circPack = cp(boundCoords, depth=8)
>>> verts = circPack.triMesh()
>>> from numpy import array
>>> from circpacker.basegeom import Polygon
>>> from circpacker.packer import CircPacking as cp
>>> coordinates = array([[2, 2], [2, 6], [8, 6], [8, 2]])
>>> polygon = Polygon(coordinates)
>>> boundCoords= polygon.boundCoords
>>> circPack = cp(boundCoords, depth=3)
>>> verts =  circPack.triMesh()
generator()[source]

Method to generate circular particles in each triangle of the triangular mesh.

Returns:list that contain all the circles object packed in the polygon.
Return type:listCirc (list of Circle objects)

Examples

>>> from numpy import array
>>> from circpacker.packer import CircPacking as cp
>>> coords = array([[2, 2], [2, 6], [8, 6], [8, 2]])
>>> circPack = cp(coords, depth=4)
>>> lstCircles = circPack.generator() # list of circles
plot(plotTriMesh=False)[source]

Method for show a graphic of the circles generated within of the polyhon.

Parameters:plotTriMesh (bool) – Variable to check if it also want to show the graph of the triangles mesh. The default value is False

Examples

(Source code)

>>> 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], [6, 4], [8, 3],
                         [7, 1], [4.5, 1], [4, 0]])
>>> polygon = Polygon(coordinates)
>>> boundCoords = polygon.boundCoords
>>> pckCircles = cp(boundCoords, depth=8)
>>> pckCircles.plot()
>>> from circpacker.slopegeometry import AnthropicSlope
>>> from circpacker.packer import CircPacking as cp
>>> slopeGeometry = AnthropicSlope(12, [1, 1.5], 10, 10)
>>> boundCoords = slopeGeometry.boundCoords
>>> pckCircles = cp(boundCoords, depth=3)
>>> pckCircles.plot(plotTriMesh=True)

(Source code)

frecHist()[source]

Method to show the histogram of the diameters of the circular particles packed in a closed polygon in \(\mathbb{R}^2\).

Examples

(Source code, png, hires.png, pdf)

_images/packer-3.png
logDiagram()[source]

Method to show the log-log graph of the diameters and quantities of circular particles packed in a closed polygon in \(\mathbb{R}^2\).

Examples

(Source code, png, hires.png, pdf)

_images/packer-4.png