Generates a constrained Delaunay triangulation from point coordinates, optionally with boundary constraints. The resulting mesh can be used directly with tulpa's SPDE spatial fields.
Usage
tulpa_mesh(
coords,
data = NULL,
boundary = NULL,
max_edge = NULL,
cutoff = 0,
extend = 0.1,
min_angle = NULL,
max_area = NULL,
max_steiner = 10000L
)
# S3 method for class 'tulpa_mesh'
print(x, ...)Arguments
- coords
A matrix or data.frame with columns x and y, or a formula like
~ x + yevaluated indata.- data
Optional data.frame for formula evaluation.
- boundary
Optional boundary specification: a matrix of boundary vertex coordinates (N x 2), an sf polygon, or NULL for convex hull.
- max_edge
Maximum edge length. A single value or a vector of two values
c(inner, outer)whereinnercontrols the study area andoutercontrols the extension region.- cutoff
Minimum distance between mesh vertices. Points closer than this are merged. Default 0 (no merging).
- extend
Numeric extension factor beyond the boundary. Default 0.1 (10% of domain diameter). Set to 0 for no extension.
- min_angle
Minimum angle (degrees) for Ruppert refinement. If specified, Steiner points are inserted at circumcenters of triangles with angles below this threshold. Theoretical maximum is ~20.7 degrees; values up to 30 usually work. Default
NULL(no refinement).- max_area
Maximum triangle area for refinement. Triangles larger than this are refined regardless of angle quality. Default
NULL(no area constraint).- max_steiner
Maximum number of Steiner points to insert during Ruppert refinement. Default 10000.
- x
A
tulpa_meshobject.- ...
Additional arguments (ignored).
Value
A tulpa_mesh object with components:
vertices: N x 2 matrix of vertex coordinatestriangles: M x 3 integer matrix of vertex indices (1-based)edges: K x 2 integer matrix of edge vertex indices (1-based)n_vertices: number of mesh verticesn_triangles: number of trianglesn_edges: number of edgesn_input_points: number of original input points
The tulpa_mesh object x, returned invisibly.