Learn R Programming

cwhmisc (version 5.0)

vector: simple vector operations

Description

Vector product(right handed), length of vector, angle between vectors.

Usage

angle(v,w)
  lV( v )
  vecprod(v, w)
  v %v% w

Arguments

v, w
3-vectors (x, y, z).

Value

  • v %v% w same as vecprod(v, w)

Examples

Run this code
tau <- (1+sqrt(5))/2  # 1.618034
a <- c(1/tau,tau,0) # vertex of dodecahedron next to y-axis
b <- c(0,1,0)  # y-axis
deg( angle(a,b))  #  20.905157 Degrees
vecprod(a, b)  # 0 0 0.61803399

Run the code above in your browser using DataLab