Recipes#
- sigmaepsilon.mesh.recipes.circular_disk(nangles: int, nradii: int, rmin: float, rmax: float, frame: CartesianFrame | None = None) TriMesh [source]#
Returns the triangulation of a circular disk.
- Parameters:
- Return type:
Examples
>>> from sigmaepsilon.mesh.recipes import circular_disk >>> mesh = circular_disk(120, 60, 5, 25)
- sigmaepsilon.mesh.recipes.circular_helix(a: Number | None = None, b: Number | None = None, *, slope: Number | None = None, pitch: Number | None = None) Callable[[Number], Tuple[float, float, float]] [source]#
Returns the function \(f(t) = [a \cdot cos(t), a \cdot sin(t), b \cdot t]\), which describes a circular helix of radius a and slope a/b (or pitch 2πb).
- sigmaepsilon.mesh.recipes.cylinder(shape, size: tuple | float | int | None = None, *, regular: bool = True, voxelize: bool = False, celltype: PolyCellProtocol | None = None, frame: CartesianFrame | None = None, **kwargs) PolyData [source]#
Returns the coordinates and the topology of cylinder as numpy arrays.
- Parameters:
shape (tuple or int, Optional) – A 2-tuple or a float, describing the shape of the cylinder.
size (Union[tuple, float, int], Optional) –
Parameter controlling the density of the mesh. Default is None.
If voxelize is
False
,size
must be a tuple of three integers, describing the number of angular, radial, and vertical divions in this order.If voxelize is
True
andsize
is afloat
, the parameter controls the size of the individual voxels.If voxelize is
True
andsize
is anint
, the parameter controls the size of the individual voxels according to \(edge \, length = (r_{ext} - r_{int})/shape\).regular (bool, Optional) – If
True
andvoxelize
is False, the mesh us a result of an extrusion applied to a trianglarion, and as a consequence it returns a more or less regular mesh. Otherwise the cylinder is created from a surface trangulation using thetetgen
package. Default isTrue
.voxelize (bool, Optional) – If
True
, the cylinder gets voxelized to a collection of H8 cells. In this case the size of a voxel can be controlled by specifying a flaot or an integer as the second parametersize
. Default isFalse
.celltype – Specifies the celltype to be used.
- Return type:
- sigmaepsilon.mesh.recipes.perforated_cube(lx: float, ly: float, lz: float, radius: float, *, nangles: int | None = None, lmax: float | None = None, order: int = 1, prismatic: bool = True) PolyData [source]#
Returns a cube of side lengths ‘lx’, ‘ly’ and ‘lz’, with a circular hole along the ‘z’ axis.
- Return type:
- sigmaepsilon.mesh.recipes.ribbed_plate(lx: float, ly: float, t: float, *, wx: float | None = None, wy: float | None = None, hx: float | None = None, hy: float | None = None, ex: float | None = None, ey: float | None = None, lmax: float | None = None, order: int = 1, tetrahedralize: bool = False) PolyData [source]#
Creates a ribbed plate.
- Parameters:
lx (float) – The length of the plate along the X axis.
ly (float) – The length of the plate along the Y axis.
t (float) – The thickness of a plate.
wx (float, Optional) – The width of the ribs running in X direction. Must be defined alongside hx. Default is None.
hx (float, Optional) – The height of the ribs running in X direction. Must be defined alongside wx. Default is None.
ex (float, Optional) – The eccentricity of the ribs running in X direction.
wy (float, Optional) – The width of the ribs running in Y direction. Must be defined alongside hy. Default is None.
hy (float, Optional) – The height of the ribs running in Y direction. Must be defined alongside wy. Default is None.
ey (float, Optional) – The eccentricity of the ribs running in Y direction.
lmax (float, Optional) – Maximum edge length of the cells in the resulting mesh. Default is None.
order (int, Optional) – Determines the order of the cells used. Allowed values are 1 and 2. If order is 1, either H8 hexahedra or TET4 tetrahedra are returned. If order is 2, H27 hexahedra or TET10 tetrahedra are returned.
tetrahedralize (bool, Optional) – If True, a mesh of 4-noded tetrahedra is returned. Default is False.
Example
>>> from sigmaepsilon.mesh.recipes import ribbed_plate >>> mesh = ribbed_plate(lx=5.0, ly=5.0, t=1.0, >>> wx=1.0, hx=2.0, ex=0.05, >>> wy=1.0, hy=2.0, ey=-0.05)
- Return type:
- sigmaepsilon.mesh.recipes.sphere(radius: float, n_azimuthal_divisions: int, n_polar_divisions: int | None = None) PolyData [source]#
Generate a triangulated mesh representing a sphere.
- Parameters:
- Return type:
Notes
This function generates a triangulated mesh of a sphere using separate divisions for azimuthal and polar angles. The resulting mesh represents a sphere with given radius and resolution.
Examples
>>> from sigmaepsilon.mesh import PolyData >>> from sigmaepsilon.mesh.recipes import sphere >>> mesh: PolyData = sphere(1.0, 20, 10)