get_2d_normal_vector: Get normal vector for given 2D vector.

Description Usage Arguments Value Examples

View source: R/utils.R

Description

Get normal vector for given 2D vector.

Usage

1
get_2d_normal_vector(v, upwards = TRUE)

Arguments

v

A 2D vector.

upwards

Vector direction is selected so it points in positive y-direction by default.

Value

A 2D vector of length one.

Examples

1
2
3
4
5
6
7
v <- c(1,1)
 u <- get_2d_normal_vector(v)
 d <- get_2d_normal_vector(v, upwards=FALSE)
 plot(NULL, xlim=c(-1,1), ylim=c(-1,1), asp=1)
 arrows(0, 0, v[1], v[2])
 arrows(0, 0, u[1], u[2], col=2)
 arrows(0, 0, d[1], d[2], col=3)

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