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.13900275 0.10703235 0.09000676
#>
#> $vectors
#> x y z
#> [1,] 0.1044082 0.3128949 -0.94403162
#> [2,] 0.9656739 -0.2589081 0.02098788
#> [3,] -0.2378504 -0.9138180 -0.32918657
#>
v_unif("line", n = 100, method = "rotasym") |>
ortensor() |>
or_eigen()
#> eigen() decomposition
#> $values
#> [1] 0.17030469 0.11962501 0.05829888
#>
#> $vectors
#> x y z
#> [1,] 0.9557608 -0.24096646 -0.16869059
#> [2,] -0.2422017 -0.97013158 0.01352918
#> [3,] -0.1669121 0.02792649 -0.98557620
#>