getAngle: Return the angle between to vectors, u and v.

Description Usage Arguments Details Value Examples

View source: R/getAngle.R

Description

This function returns the angle between two vectors u and v. If u and v are orthogonal then the angle will be 90 degrees. This is a helper function for dMisc::plotCovEllipse(). It can be called directly if needed.

Usage

1
getAngle(u, v)

Arguments

u

a vector of numeric values. (Must be at least length = 2)

v

a vector of numeric values. (Must be at least length = 2)

Details

Original code from StackOverflow, but I don't have attribution.

Value

the angle between the two vectors u and v.

Examples

1
2
3
u <- rnorm(5,0,1)
v <- rnorm(5,0,1.5)
getAngle(u,v)

gtog/dMisc documentation built on May 17, 2019, 8:57 a.m.