Description Usage Arguments Value Examples
Retrieves the Delaunay Mesh for a series of x and y points in 2D.
With the exception of a few brief checks, is almost a direct wrapper to the delaunayn
function as part of the geometry package.
1 | getDelaunayMesh(x, y)
|
x |
numeric vector of x values |
y |
numeric vector of y values of same length as x |
matrix
object having three columns that represent the (1-based) indexes of each vertex
relative to the data in the x
and y
input parameters.
1 2 3 4 5 6 7 8 9 10 11 12 13 | #Generate a sample Delaunay Mesh
set.seed(1)
x = runif(100)
y = runif(100)
dm = getDelaunayMesh(x,y)
#To demonstrate, Lets view the mesh
library(ggplot2)
library(reshape)
df = as.data.frame(dm); df$id = 1:nrow(df); df = melt(df,id="id")
df = cbind(df,data.frame(x,y)[df$value,])
ggplot(data=df,aes(x,y,group=id)) +
geom_polygon(aes(fill=id),color="gray")
|
Loading required package: geometry
Loading required package: magic
Loading required package: abind
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.