Create uniformly distributed vectors using the algorithm Spherical Fibonacci Spiral points on a sphere algorithm (John Burkardt) or Golden Section Spiral points on a sphere.
Usage
v_unif(class = NULL, n = 100, method = c("gss", "sfs", "rotasym"))
Arguments
- class
character. Coordinate class of the output vectors.
- n
number of observations
- method
character. The algorithm for generating uniformly distributed vectors. Either
"sfs"
for the "Spherical Fibonacci Spiral points on a sphere","gss"
for "Golden Section Spiral points on a sphere", or the algorithmrotasym::r_unif_sphere()
from the rotasym package.
Details
"sfs"
algorithm is from on John Burkardt (http://people.sc.fsu.edu/~jburkardt/),
"gss
is from http://www.softimageblog.com/archives/115
See also
rvmf()
to draw samples from the von Mises Fisher distribution
around a specified mean vector.
Examples
v_unif("line", n = 100, method = "sfs") |>
ortensor() |>
or_eigen()
#> eigen() decomposition
#> $values
#> [1] 0.1114462 0.1111266 0.1107611
#>
#> $vectors
#> x y z
#> [1,] -0.7218896 -3.330669e-16 6.920082e-01
#> [2,] 0.0000000 1.000000e+00 4.440892e-16
#> [3,] 0.6920082 -3.330669e-16 7.218896e-01
#>
v_unif("line", n = 100, method = "gss") |>
ortensor() |>
or_eigen()
#> eigen() decomposition
#> $values
#> [1] 0.13783727 0.10778194 0.09026058
#>
#> $vectors
#> x y z
#> [1,] 0.09081321 0.2906384 -0.95251367
#> [2,] 0.97723435 -0.2101655 0.02904276
#> [3,] -0.19174458 -0.9334665 -0.30310762
#>
v_unif("line", n = 100, method = "rotasym") |>
ortensor() |>
or_eigen()
#> eigen() decomposition
#> $values
#> [1] 0.16695297 0.11708304 0.06211421
#>
#> $vectors
#> x y z
#> [1,] 0.9338097 -0.327763979 -0.14342291
#> [2,] -0.3241807 -0.944758683 0.04835215
#> [3,] -0.1513481 0.001343226 -0.98847961
#>