plotHdelaunay {gyro} | R Documentation |
Plot hyperbolic Delaunay triangulation
Description
Plot a hyperbolic Delaunay triangulation obtained
with hdelaunay
.
Usage
plotHdelaunay(
hdel,
vertices = TRUE,
edges = TRUE,
circle = TRUE,
color = "random",
distinctArgs = list(seedcolors = c("#ff0000", "#00ff00", "#0000ff")),
randomArgs = list(hue = "random", luminosity = "bright")
)
Arguments
hdel |
an output of |
vertices |
Boolean, whether to plot the vertices |
edges |
Boolean, whether to plot the edges |
circle |
Boolean, whether to plot the unit circle; ignored for the Ungar model |
color |
this argument controls the colors of the triangles; it can be
|
distinctArgs |
if |
randomArgs |
if |
Value
No returned value, just generates a plot.
Examples
library(gyro)
library(uniformly)
set.seed(666)
points <- runif_in_sphere(35L, d = 2)
hdel <- hdelaunay(points, model = "M")
plotHdelaunay(hdel)
points <- runif_in_sphere(35L, d = 2, r = 0.7)
hdel <- hdelaunay(points, model = "U")
plotHdelaunay(hdel)
# example with colors given by a function ####
library(gyro)
if(require("trekcolors")) {
pal <- trek_pal("klingon")
} else {
pal <- hcl.colors(32L, palette = "Rocket")
}
phi <- (1 + sqrt(5)) / 2
theta <- head(seq(0, pi/2, length.out = 11), -1L)
a <- phi^((2*theta/pi)^0.8 - 1)
u <- a * cos(theta)
v <- a * sin(theta)
x <- c(0, u, -v, -u, v)
y <- c(0, v, u, -v, -u)
pts <- cbind(x, y) / 1.03
hdel <- hdelaunay(pts, model = "M")
fcolor <- function(t){
RGB <- colorRamp(pal)(t)
rgb(RGB[, 1L], RGB[, 2L], RGB[, 3L], maxColorValue = 255)
}
plotHdelaunay(
hdel, vertices = FALSE, circle = FALSE, color = fcolor
)
[Package gyro version 1.4.0 Index]