Nothing
distance <- function(A, B){
sqrt(c(crossprod(A-B)))
}
triangleArea <- function(A, B, C){
a <- distance(B, C)
b <- distance(A, C)
c <- distance(A, B)
s <- (a + b + c) / 2
sqrt(s*(s-a)*(s-b)*(s-c))
}
delaunayArea <- function(vertices, triangles){
ntriangles <- nrow(triangles)
areas <- numeric(ntriangles)
for(i in 1L:ntriangles){
points <- vertices[triangles[i, ], ]
areas[i] <- triangleArea(points[1L, ], points[2L, ], points[3L, ])
}
sum(areas)
}
makeTriangle <- function(vertices, indices){
vertices[indices, ]
}
subtractEdges <- function(Edges, edges){
if(is.null(edges)){
return(Edges)
}
if(nrow(Edges) == nrow(edges)){
return(NULL)
}
Strings <- paste0(Edges[, 1L], "-", Edges[, 2L])
strings <- paste0(edges[, 1L], "-", edges[, 2L])
rownames(Edges) <- Strings
keep <- setdiff(Strings, strings)
Edges[keep, ]
}
unionEdges <- function(edges1, edges2){
if(is.null(edges2)){
return(edges1)
}
Edges <- rbind(edges1, edges2)
Edges[!duplicated(Edges), ]
# strings1 <- paste0(edges1[, 1L], "-", edges1[, 2L])
# strings2 <- paste0(edges2[, 1L], "-", edges2[, 2L])
# strings <- union(strings1, strings2)
}
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.