Generates delaunay triangles with ct_triangulate().

triangulate_delaunay(
  boundaries,
  with = NULL,
  boundary = "sfa",
  sample_surface = FALSE,
  sample_points = FALSE,
  nb_samples = NULL,
  min_size = 1000,
  seed = 1,
  ...
)

Arguments

boundaries

[sf] The boundaries to be used.

with

[sf] A set of data points to use for voronoisation.

boundary

[character] The column in boundaries that is to be used for the stratified sampling.

sample_surface

[logical] Whether to sample the surfaces in boundaries, Default to FALSE.

sample_points

[logical] Whether to sample points from with or to take all points in with. Default to TRUE.

nb_samples

[named character vector] The number of samples to draw by boundary polygons (must bear the levels of boundary as names or be a single value to be applied to each level).

min_size

[numeric] The minimum size for a triangle above which it will be merged (in km2).

seed

[numeric] Passed onto set.seed(), important for reproducibility of sampling.

...

Arguments passed on to RTriangle::triangulate

p

Planar straight line graph object; see pslg.

a

Maximum triangle area. If specified, triangles cannot be larger than this area.

q

Minimum triangle angle in degrees.

Y

If TRUE prohibits the insertion of Steiner points on the mesh boundary.

j

If TRUE jettisons vertices that are not part of the final triangulation from the output.

D

If TRUE produce a conforming Delaunay triangulation. This ensures that all the triangles in the mesh are truly Delaunay, and not merely constrained Delaunay. This option invokes Ruppert's original algorithm, which splits every subsegment whose diametral circle is encroached. It usually increases the number of vertices and triangles.

S

Specifies the maximum number of added Steiner points.

V

Verbosity level. Specify higher values for more detailed information about what the Triangle library is doing.

Q

If TRUE suppresses all explanation of what the Triangle library is doing, unless an error occurs.

Value

A named list with three elements (each an sf object): * patches, the voronoi polygons generated * points, the points used for the tessellation.

Examples

data(borealis_simulated, package = "sspm")
data(sfa_boundaries, package = "sspm")
triangulate_delaunay(sfa_boundaries, with = borealis, sample_surface = TRUE,
                     boundary = "sfa", nb_samples = 10)
#> $patches
#> Simple feature collection with 85 features and 3 fields
#> Geometry type: MULTIPOLYGON
#> Dimension:     XY
#> Bounding box:  xmin: -62.90629 ymin: 46.61749 xmax: -47.45254 ymax: 60.64649
#> Geodetic CRS:  WGS 84
#> # A tibble: 85 × 4
#>    sfa   patch_id patch_area                                            geometry
#>  * <chr> <fct>        [km^2]                                  <MULTIPOLYGON [°]>
#>  1 4     P1         3366.    (((-62.90629 60.64649, -62.35403 59.95055, -61.152…
#>  2 4     P2           30.7   (((-55.40886 49.58828, -55.56052 49.88607, -55.571…
#>  3 4     P3           95.4   (((-55.61135 49.98503, -56.01238 50.75091, -56.022…
#>  4 4     P4         1117.    (((-60.42692 57.69196, -62.90629 60.64649, -62.354…
#>  5 4     P5            0.399 (((-54.06518 46.77227, -53.99501 46.61749, -54.064…
#>  6 4     P6          819.    (((-60.46593 57.66767, -58.704 55.21329, -58.69987…
#>  7 4     P7         1511.    (((-61.15296 60.43046, -62.35403 59.95055, -61.786…
#>  8 4     P8         1665.    (((-61.42425 59.71627, -60.87372 59.20766, -61.152…
#>  9 4     P9         1150.    (((-61.78665 59.77074, -62.35403 59.95055, -61.000…
#> 10 4     P10        1790.    (((-60.4377 58.94603, -61.00018 58.85463, -59.8071…
#> # ℹ 75 more rows
#> 
#> $points
#> Simple feature collection with 40 features and 1 field
#> Geometry type: POINT
#> Dimension:     XY
#> Bounding box:  xmin: -62.90629 ymin: 46.61749 xmax: -47.45254 ymax: 60.64649
#> Geodetic CRS:  WGS 84
#> First 10 features:
#>    sfa                   geometry
#> 1    4 POINT (-62.90629 60.64649)
#> 2    4 POINT (-61.42425 59.71627)
#> 3    4 POINT (-59.80715 58.05237)
#> 4    4  POINT (-59.6313 57.70761)
#> 5    4 POINT (-61.00018 58.85463)
#> 6    4 POINT (-61.15296 60.43046)
#> 7    4 POINT (-60.87372 59.20766)
#> 8    4 POINT (-61.78665 59.77074)
#> 9    4 POINT (-62.35403 59.95055)
#> 10   4  POINT (-60.4377 58.94603)
#>