shapes.circle#
- shapes.circle(radius=1.0, center=(0.0, 0.0, 0.0), div=24, rad_div=3, eltype='line2')#
Create a polygonal circle in the xy-plane.
Parameters#
- radiusfloat, optional
Radius of the circle. Default is 1.0.
- centerarray_like of shape (3,), optional
Coordinates of the circle center. Default is (0.0, 0.0, 0.0).
- divint, optional
Number of segments used to discretize the circumference. - For
tri3andline2, any integer >= 3 is allowed. - Forquad4, must be a multiple of 4.- rad_divint, optional
Number of radial subdivisions. Only applicable when
eltype="quad4". This specifies how many divisions are made in the radial direction between the inner rectangular grid and the circumference. Must be an integer >= 1. Default is 3.- eltype{“line2”, “tri3”, ‘quad4’}, optional
Element type of the mesh to return:
“line2”: return the circle contour as 2-node line elements.
“tri3”: return a filled circle with 3-node triangular elements, connecting the contour to the center.
“quad4”: quadrilateral mesh filling the circle.
Returns#
- Mesh
A mesh with the requested element type.
Notes#
Low values for
divresult in polygons. Thus circle(3) is an equilateral triangle and circle(6) is regular hexagon.Examples#
>>> C1 = circle(radius=1.0, div=4, eltype='line2') >>> print(C1) Mesh: n_nodes: 4, n_elems: 4, plexitude: 2, level: 1, eltype: line2 BBox: [-1. -1. 0.], [1. 1. 0.] Size: [2. 2. 0.] Length: 5.657 >>> print(C1.coords) [[ 1. 0. 0.] [ 0. 1. 0.] [-1. 0. 0.] [-0. -1. 0.]]
Circle filled with triangles:
>>> C2 = circle(radius=2.0, center=[2.0, 2.0, 0.0], div=8, eltype='tri3') >>> print(C2) Mesh: n_nodes: 9, n_elems: 8, plexitude: 3, level: 2, eltype: tri3 BBox: [0. 0. 0.], [4. 4. 0.] Size: [4. 4. 0.] Length: 12.25 Area: 11.31
Circle filled with quadrilateral elements:
>>> C3 = circle(div=12, rad_div=4, eltype="quad4") >>> print(C3) Mesh: n_nodes: 64, n_elems: 57, plexitude: 4, level: 2, eltype: quad4 BBox: [-1. -1. 0.], [1. 1. 0.] Size: [2. 2. 0.] Length: 6.212 Area: 3.0