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 78 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: 78 × 4
#>    sfa   patch_id patch_area                                            geometry
#>  * <chr> <fct>        [km^2]                                  <MULTIPOLYGON [°]>
#>  1 4     P1          3345.   (((-62.90629 60.62645, -62.35403 59.93536, -61.152…
#>  2 4     P2             6.48 (((-55.55848 51.01214, -55.65483 51.17594, -55.659…
#>  3 4     P3          1841.   (((-60.21451 57.69104, -62.90629 60.62645, -62.354…
#>  4 4     P4             5.56 (((-55.53944 50.97306, -55.32141 50.6038, -55.5367…
#>  5 4     P5          1747.   (((-60.25425 57.66822, -60.25425 57.66822, -60.285…
#>  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…
#> # … with 68 more rows
#> 
#> $points
#> Simple feature collection with 40 features and 1 field
#> 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                   geometry
#> 1    4 POINT (-62.90629 60.62645)
#> 2    4 POINT (-61.42425 59.70269)
#> 3    4 POINT (-59.80715 58.04987)
#> 4    4  POINT (-59.6313 57.70734)
#> 5    4 POINT (-61.00018 58.84686)
#> 6    4 POINT (-61.15296 60.41194)
#> 7    4 POINT (-60.87372 59.19752)
#> 8    4 POINT (-61.78665 59.75678)
#> 9    4 POINT (-62.35403 59.93536)
#> 10   4  POINT (-60.4377 58.93765)
#>