Vector operations
Usage
vlength(x)
vsum(x, w = NULL)
vnorm(x)
vcross(x, y)
vdot(x, y)
vrotate(x, rotaxis, rotangle)
vangle(x, y)
vproject(x, y)
vreject(x, y)
Examples
vec1 <- cbind(1, 0, 0)
vec2 <- cbind(0, 0, 1)
vlength(vec1)
#> [1] 1
vsum(vec1)
#> [,1] [,2] [,3]
#> [1,] 1 0 0
vnorm(vec1)
#> [,1] [,2] [,3]
#> [1,] 1 0 0
vcross(vec1, vec2)
#> x y z
#> [1,] 0 -1 0
vdot(vec1, vec2)
#> [1] 0
vrotate(vec1, vec2, pi / 2)
#> x y z
#> [1,] 2.220446e-16 1 0
vangle(vec1, vec2)
#> [1] 1.570796
vproject(vec1, vec2)
#> x y z
#> [1,] 0 0 0
vreject(vec1, vec2)
#> x y z
#> [1,] 1 0 0