linesTorus3d {sdetorus}R Documentation

Lines and arrows with wrapping in the torus

Description

Joins the corresponding points with line segments or arrows that exhibit wrapping in [-\pi,\pi) in the horizontal and vertical axes.

Usage

linesTorus3d(x, y, z, col = 1, arrows = FALSE, ...)

Arguments

x, y

vectors with horizontal coordinates, wrapped in [-\pi,\pi).

z

vector with vertical coordinates, wrapped in [-\pi,\pi).

col

color vector of length 1 or the same length of x, y, and z.

arrows

flag for drawing arrows instead of line segments.

...

further graphical parameters passed to segments or arrows.

Details

x, y, and z are wrapped to [-\pi,\pi) before plotting. arrows = TRUE makes sequential calls to arrow3d, and is substantially slower than arrows = FALSE.

Value

Nothing. The functions are called for drawing wrapped lines.

Examples


if (requireNamespace("rgl")) {
  n <- 20
  x <- toPiInt(rnorm(n, mean = seq(-pi, pi, l = n), sd = 0.5))
  y <- toPiInt(rnorm(n, mean = seq(-pi, pi, l = n), sd = 0.5))
  z <- toPiInt(x + y + rnorm(n, mean = seq(-pi, pi, l = n), sd = 0.5))
  rgl::plot3d(x, y, z, xlim = c(-pi, pi), ylim = c(-pi, pi),
              zlim = c(-pi, pi), col = rainbow(n), size = 2,
              box = FALSE, axes = FALSE)
  linesTorus3d(x = x, y = y, z = z, col = rainbow(n), lwd = 2)
  torusAxis3d()
  rgl::plot3d(x, y, z, xlim = c(-pi, pi), ylim = c(-pi, pi),
              zlim = c(-pi, pi), col = rainbow(n), size = 2,
              box = FALSE, axes = FALSE)
  linesTorus3d(x = x, y = y, z = z, col = rainbow(n), ltyCross = 2,
               arrows = TRUE, theta = 0.1 * pi / 180, barblen = 0.1)
  torusAxis3d()
}


[Package sdetorus version 0.1.10 Index]