rotation_matrix_2d: Generate a 2D rotation matrix

Description Usage Arguments Value Examples

View source: R/utils.R

Description

Generate a 2D rotation matrix

Usage

1
rotation_matrix_2d(alpha = 0, clockwise = TRUE)

Arguments

alpha

Angle in radians, clockwise

clockwise

Rotate clockwise?

Value

A 2D rotation matrix

Examples

1
2
3
4
5
6
7
v <- c(0,1)                                  # point
as <- seq(0, pi/2, length=10)                # radians to rotate
plot(NULL, xlim=c(-1,1), ylim=c(-1,1), asp=1)
for (a in as)
  points(v %*% rotation_matrix_2d(a))
for (a in as)
  points(v %*% rotation_matrix_2d(a, FALSE), col="red")

markheckmann/dissertation documentation built on May 21, 2019, 12:06 p.m.