Skip to main content

raygeo.mesh.build

Uniform mesh (top) and Laplace gradient field (bottom) from build_uniform_mesh.

Uniform mesh (top) and Laplace gradient field (bottom) from build_uniform_mesh.

Functions

build_triangle_mesh()

build_triangle_mesh(
outer: Sequence[tuple[float, float]],
holes: Sequence[Sequence[tuple[float, float]]] = (),
tool_radius: float = 0,
min_angle: float = 20,
) -> types.TriangleMesh

Build a constrained Delaunay triangle mesh from polygon boundaries.

ParameterTypeDescription
outerSequence[tuple[float, float]]Outer boundary polygon vertices as (x, y) tuples.
holesSequence[Sequence[tuple[float, float]]] = ()Sequence of hole/island polygons.
tool_radiusfloat = 0Tool radius for offsetting the outer boundary inwards.
min_anglefloat = 20Minimum triangle angle for Steiner point refinement.
Returnstypes.TriangleMeshTriangleMesh with boundary tags.
ComplexityO(n log n) where n = number of Steiner points

CDT triangulation of a square pocket with centred hole

CDT triangulation of a square pocket with centred hole

CDT triangulation of an L-shaped pocket

CDT triangulation of an L-shaped pocket

CDT triangulation of a square pocket with multiple islands

CDT triangulation of a square pocket with multiple islands

build_uniform_mesh()

build_uniform_mesh(
outer: Sequence[tuple[float, float]],
holes: Sequence[Sequence[tuple[float, float]]] = (),
tool_radius: float = 0,
target_edge_len: float = 1,
) -> types.TriangleMesh

Build a triangle mesh with approximately uniform edge length.

Computes the Steiner point density needed to achieve target_edge_len and delegates to build_triangle_mesh.

ParameterTypeDescription
outerSequence[tuple[float, float]]Outer boundary polygon.
holesSequence[Sequence[tuple[float, float]]] = ()List of hole/island polygons.
tool_radiusfloat = 0Offsets outer boundary inward.
target_edge_lenfloat = 1Desired edge length.
Returnstypes.TriangleMeshTriangleMesh with uniform-sized elements.
ComplexityO(n log n) where n = number of Steiner points