Calculates the area of a Dirichlet tile, applying a discrete version of Stoke's theorem.

tileArea(x, y, rw)

Arguments

x

The x-coordinates of the vertices of the tile, in anticlockwise direction. The last coordinate should not repeat the first.

y

The y-coordinates of the vertices of the tile, in anticlockwise direction. The last coordinate should not repeat the first.

rw

A vector of length 4 specifying the rectangular window in which the relevant tessellation was constructed. See deldir() for more detail. Actually this can be any rectangle containing the tile in question.

Details

The heavy lifting is done by the Fortran subroutine stoke() which is called by the .Fortran() function.

Value

A positive scalar.

Author

Rolf Turner rolfurner@posteo.net

See also

Examples

set.seed(42)
x <- runif(20)
y <- runif(20)
z <- deldir(x,y,rw=c(0,1,0,1))
w <- tile.list(z)
with(w[[1]],tileArea(x,y,rw=z$rw))
#> [1] 0.01673089
sapply(w,function(x,rw){tileArea(x$x,x$y,attr(w,"rw"))})
#>       pt.1       pt.2       pt.3       pt.4       pt.5       pt.6       pt.7       pt.8       pt.9      pt.10 
#> 0.01673089 0.04375112 0.02325225 0.02028819 0.06814804 0.07188510 0.04985293 0.05696854 0.04535698 0.02828429 
#>      pt.11      pt.12      pt.13      pt.14      pt.15      pt.16      pt.17      pt.18      pt.19      pt.20 
#> 0.03946221 0.03944295 0.05690313 0.11192240 0.05506540 0.04097512 0.01092658 0.14364597 0.04189607 0.03524183 
x <- c(0.613102,0.429294,0.386023,0.271880,0.387249,0.455900,0.486101)
y <- c(0.531978,0.609665,0.597780,0.421738,0.270596,0.262953,0.271532)
# The vertices of the Dirichlet tile for point 6.
tileArea(x,y,rw=c(0,1,0,1))
#> [1] 0.0718851
tileArea(x,y,rw=c(-1,2,-3,4)) # Same as above.
#> [1] 0.0718851