Learn R Programming

Morpho (version 2.1)

crossp: calculate the orthogonal complement of a 3D-vector

Description

calculate the orthogonal complement of a 3D-vector

Usage

crossp(x, y)

tanplan(x)

Arguments

x
vector of length 3.
y
vector of length 3.

Value

  • tanplan:

    crossp: returns a vector of length 3.

  • yvector orthogonal to x
  • zvector orthogonal to x and y

Details

calculate the orthogonal complement of a 3D-vector or the 3D-crossproduct, finding an orthogonal vector to a plane in 3D.

Examples

Run this code
require(rgl)

x <- c(1,0,0)
y <- c(0,1,0)

#example tanplan
z <- tanplan(x)
#visualize result
lines3d(rbind(0, x), col=2, lwd=2)
## show complement
lines3d(rbind(z$y, 0, z$z), col=3, lwd=2)
# example crossp
z <- crossp(x, y)
# show x and y
lines3d(rbind(x, 0, y), col=2, lwd=2)
# show z
lines3d(rbind(0, z), col=3, lwd=2)

Run the code above in your browser using DataLab