The Delaunay triangulation is a tessellation of the convex hull of the points such that no \(N\)-sphere defined by the \(N\)- triangles contains any other points from the set.
delaunayn(p, options = NULL, output.options = NULL, full = FALSE)
If output.options
is NULL
(the default),
return the Delaunay triangulation as a matrix with \(M\) rows
and \(N+1\) columns in which each row contains a set of
indices to the input points p
. Thus each row describes a
simplex of dimension \(N\), e.g. a triangle in 2D or a
tetrahedron in 3D.
If the output.options
argument is TRUE
or is a
string containing Fn
or Fa
, return a list with
class delaunayn
comprising the named elements:
tri
The Delaunay triangulation described above
areas
If TRUE
or if Fa
is specified, an
\(M\)-dimensional vector containing the generalised area of
each simplex (e.g. in 2D the areas of triangles; in 3D the volumes
of tetrahedra). See ../doc/qhull/html/qh-optf.html#Fa.
neighbours
If TRUE
or if Fn
is specified,
a list of neighbours of each simplex. Note that a negative number
corresponds to "facet" (="edge" in 2D or "face" in 3D) that has no
neighbour, as will be the case for some simplices on the boundary
of the triangulation.
See ../doc/qhull/html/qh-optf.html#Fn
An \(M\)-by-\(N\) matrix whose rows represent \(M\) points in \(N\)-dimensional space.
String containing extra control options for the underlying Qhull command; see the Qhull documentation (../doc/qhull/html/qdelaun.html) for the available options.
The Qbb
option is always passed to Qhull. The remaining
default options are Qcc Qc Qt Qz
for \(N<4\) and
Qcc Qc Qt Qx
for \(N>=4\). If neither of the QJ
or Qt
options are supplied, the Qt
option is
passed to Qhull. The Qt
option ensures all Delaunay
regions are simplical (e.g., triangles in 2D). See
../doc/qhull/html/qdelaun.html for more details. Contrary
to the Qhull documentation, no degenerate (zero area) regions
are returned with the Qt
option since the R function
removes them from the triangulation.
If options
is specified, the default options are
overridden. It is recommended to use output.options
for
options controlling the outputs.
String containing Qhull options to control
output. Currently Fn
(neighbours) and Fa
(areas)
are supported. Causes an object of return value for details. If
output.options
is TRUE
, select all supported
options.
Deprecated and will be removed in a future release.
Adds options Fa
and Fn
.
Raoul Grasman and Robert B. Gramacy; based on the corresponding Octave sources of Kai Habel.
Barber, C.B., Dobkin, D.P., and Huhdanpaa, H.T., “The Quickhull algorithm for convex hulls,” ACM Trans. on Mathematical Software, Dec 1996.
tri.mesh
, convhulln
,
surf.tri
, distmesh2d
# example delaunayn
d <- c(-1,1)
pc <- as.matrix(rbind(expand.grid(d,d,d),0))
tc <- delaunayn(pc)
# example tetramesh
if (FALSE) {
rgl::view3d(60)
rgl::light3d(120,60)
tetramesh(tc,pc, alpha=0.9)
}
tc1 <- delaunayn(pc, output.options="Fa")
## sum of generalised areas is total volume of cube
sum(tc1$areas)
Run the code above in your browser using DataLab