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. If set to Inf, there is no limit on the number of Steine points added - but this can lead to huge amounts of memory being allocated.

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 70 features and 3 fields
#> Geometry type: MULTIPOLYGON
#> Dimension:     XY
#> Bounding box:  xmin: -62.90629 ymin: 46.20124 xmax: -47.38968 ymax: 60.62645
#> Geodetic CRS:  WGS 84
#> # A tibble: 70 × 4
#>    sfa   patch_id patch_area                                            geometry
#>  * <chr> <fct>        [km^2]                                  <MULTIPOLYGON [°]>
#>  1 4     P1         3887.    (((-60.6055 57.77918, -62.32017 59.94914, -61.1529…
#>  2 4     P2            9.49  (((-55.93264 50.03867, -56.20651 50.58302, -56.208…
#>  3 4     P3           15.9   (((-60.54276 57.694, -60.59819 57.76928, -60.62298…
#>  4 4     P4            0.299 (((-55.81365 49.79706, -55.73917 49.64616, -55.813…
#>  5 4     P5          448.    (((-60.55599 57.66733, -58.87251 55.22493, -58.869…
#>  6 4     P6         1502.    (((-61.15296 60.41194, -62.35403 59.93536, -61.786…
#>  7 4     P7         1654.    (((-61.42425 59.70269, -60.87372 59.19752, -61.152…
#>  8 4     P8         1143.    (((-61.78665 59.75678, -62.35403 59.93536, -61.000…
#>  9 4     P9         1779.    (((-60.4377 58.93765, -61.00018 58.84686, -59.8071…
#> 10 4     P10        1469.    (((-60.87372 59.19752, -60.4377 58.93765, -61.1529…
#> # ℹ 60 more rows
#> 
#> $points
#> Simple feature collection with 40 features and 2 fields
#> Geometry type: POINT
#> Dimension:     XY
#> Bounding box:  xmin: -62.90629 ymin: 46.20124 xmax: -47.38968 ymax: 60.62645
#> Geodetic CRS:  WGS 84
#> First 10 features:
#>    sfa              area                   geometry
#> 1    4 47575648300 [m^2] POINT (-62.90629 60.62645)
#> 2    4 47575648300 [m^2] POINT (-61.42425 59.70269)
#> 3    4 47575648300 [m^2] POINT (-59.80715 58.04987)
#> 4    4 47575648300 [m^2]  POINT (-59.6313 57.70734)
#> 5    4 47575648300 [m^2] POINT (-61.00018 58.84686)
#> 6    4 47575648300 [m^2] POINT (-61.15296 60.41194)
#> 7    4 47575648300 [m^2] POINT (-60.87372 59.19752)
#> 8    4 47575648300 [m^2] POINT (-61.78665 59.75678)
#> 9    4 47575648300 [m^2] POINT (-62.35403 59.93536)
#> 10   4 47575648300 [m^2]  POINT (-60.4377 58.93765)
#>