Skip to contents

Given a vector of three-velocities, returns their direction cosines

Usage

cosines(u, drop = TRUE)

Arguments

u

A vector of three-velocities

drop

Boolean, with default TRUE meaning to coerce return value from a one-row matrix to a vector, and FALSE meaning to consistently return a matrix

Author

Robin K. S. Hankin

Examples


cosines(r3vel(7))
#>               x          y          z
#> [1,] -0.7847426  0.5918643 -0.1840536
#> [2,]  0.5915187  0.7493984 -0.2975024
#> [3,]  0.0838383 -0.8753404  0.4761831
#> [4,]  0.9443351  0.0165019  0.3285710
#> [5,] -0.5146649 -0.2167161 -0.8295506
#> [6,]  0.6010511  0.3625150  0.7122643
#> [7,] -0.1557215  0.5098808 -0.8460334


cosines(r3vel(1),drop=TRUE)
#>            x            y            z 
#> -0.002123437  0.972412407 -0.233258659 
cosines(r3vel(1),drop=FALSE)
#>              x          y         z
#> [1,] 0.4366976 0.09444935 0.8946365