shapes.cylinder#

shapes.cylinder(radius=1.0, height=1.0, center=(0.0, 0.0, 0.0), circ_div=36, height_div=1)#

Create a triangular mesh approximating a cylinder.

Parameters#

radiusfloat, optional

Radius of the circular base. Must be > 0. Default is 1.0.

heightfloat, optional

Height of the cylinder along the z-axis. Must be > 0. Default is 1.0.

centerarray_like of shape (3,), optional

Coordinates of the cylinder base center. Default is (0.0, 0.0, 0.0).

circ_divint, optional

Number of subdivisions along the circumference of the circular base. Must be >= 3. Default is 36.

height_divint, optional

Number of subdivisions along the height. Must be >= 1. Default is 1.

Returns#

Mesh

A triangular surface mesh representing the cylinder (eltype='tri3').

Examples#

>>> C = cylinder(radius=2.0, height=5.0, circ_div=24, height_div=4)
>>> print(C)
Mesh: n_nodes: 122, n_elems: 240, plexitude: 3, level: 2, eltype: tri3
  BBox: [-2. -2.  0.], [2. 2. 5.]
  Size: [4. 4. 5.]
  Length: 0.0  Area: 87.5
>>> np.isclose(C.enclosed_volume(), 62.1165, rtol=1e-3, atol=1e-6)
True