DEL0: Convert object to a constrained-Delaunay triangulation

Description Usage Arguments Details Value Topology Licensing See Also Examples

View source: R/DEL0-model.R

Description

This structural-form Delaunay-based triangulation model is analogous to the TRI() model in the silicate package and formally extends the class of that model. A primitives-based shape-constrained triangulation. The Delaunay model is the mostly Delaunay scheme used by the provable-quality meshers.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
DEL0(x, ..., max_area = NULL)

## S3 method for class 'DEL'
DEL0(x, ..., max_area = NULL)

## Default S3 method:
DEL0(x, ..., max_area = NULL)

## S3 method for class 'SC'
DEL0(x, ..., max_area = NULL)

## S3 method for class 'SC0'
DEL0(x, ..., max_area = NULL)

## S3 method for class 'TRI'
DEL0(x, ..., max_area = NULL)

## S3 method for class 'TRI0'
DEL0(x, ..., max_area = NULL)

## S3 method for class 'ARC'
DEL0(x, ..., max_area = NULL)

## S3 method for class 'PATH'
DEL0(x, ..., max_area = NULL)

## S3 method for class 'PATH0'
DEL0(x, ..., max_area = NULL)

## S3 method for class 'BasicRaster'
DEL0(x, ..., max_triangles = NULL)

Arguments

x

object of class PATH0 or understood by PATH0()

...

ignored

max_area

the maximum area of a triangle

max_triangles

limit on triangles to create, passed to terrainmeshr

Details

This is a more compact form of the relational-form DEL() model.

Value

DEL0 class

Topology

Note that for explicitly linear features, these still use a post-meshing identification for which triangles belong in which feature. This can't make sense for many line layers, but we leave it for now.

For point features, the mesher unproblematically creates a triangulation in the convex hull of the points, any attributes names z_, m_, or t_ are automatically interpolated and include in the output. See the help for RTriangle::triangulate() for how this works via the $PA element.

Note that for a raster input the terrainmeshr package is used to determine a sensible number of triangles based on local curvature. To avoid creating this adative mesh and use as.mesh3d(QUAD(raster)) to get quad primitives or as.mesh3d(QUAD(raster), triangles = TRUE) to get triangle primitives directly from raster cells.

Licensing

The anglr package is released with license CC BY-NC-SA 4.0 to match the one dependency RTriangle. Please note and respect the license of the RTriangle package used by the DEL() or DEL0() functions in anglr, and invoked within 3D plot methods. These return high-quality constrained Delaunay triangulations of polygonal regions, with the ability to control mesh characteristics including maximum triangle area, minimum internal angle, and conformance to the Delaunay criterion. If you are interested in a less restrictive license for high-quality meshing in R please get involved with the laridae package which aims to provide access to CGAL.

See Also

DEL

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
a <- DEL0(cad_tas)
plot(a)

## ---- intepolate via triangulation, sample points from volcano
rgl::clear3d()
n <- 150
max_area <- .005 ## we working in x 0,1 y 0,1
library(anglr)
library(dplyr)
d <-
  data.frame(x = runif(n), y = runif(n), multipoint_id = 1) %>%
  dplyr::mutate(
    z = raster::extract(raster::raster(volcano), cbind(x, y)),
    multipoint_id = 1
  )

mesh <- DEL0(
  sfheaders::sf_multipoint(d, x = "x", y = "y", z = "z",
    multipoint_id = "multipoint_id"), max_area = max_area)

plot3d(mesh , color = "darkgrey", specular = "darkgrey") #sample(grey.colors(5)))

anglr documentation built on July 29, 2020, 9:06 a.m.