R/randomlines.R

Defines functions vdc

Documented in vdc

vdc <- function(n, rand.rot = FALSE){
  lines <- .C(C_vandercorput, as.integer(n), coord = double(3 * n))$coord

  if (rand.rot){
    ##Gerenerate a random rotation
    u <- runif(3, -.5, .5)
    u <- u / sqrt(sum(u^2))
    angle <- runif(1, 0, 2 * pi)

    lines <- .C(C_rotation, lines = as.double(lines), as.integer(n),
                as.double(u[1]), as.double(u[2]), as.double(u[3]),
                as.double(angle))$lines
  }

  lines <- matrix(lines, ncol = 3)
  return(lines)
}

Try the SpatialExtremes package in your browser

Any scripts or data that you put into this service are public.

SpatialExtremes documentation built on April 19, 2022, 5:06 p.m.