rotplane
Synopsis

Compute set of vectors/orientations in a plane.

v = rotplane(n,chi);
v = rotplane(n,chi12,nChi);
[phi,theta] = ...
Description

This function computes vectors in a plane perpendicular to the vector n. E.g. if n=[0 0 1], the vector represents the z axis, and the computed vectors lie all in the xy plane.

chi is a list of in-plane angles for the wanted vectors. If a two-element array chi12 and a number nChi are given, the function generates vectors for nChi angles between chi12(1) and chi12(2).

v is an array with one vector along each column. All vectors have unit length. phi and theta are the polar angles for these vectors.

Algorithm

rotplane first constructs two in-plane unit vectors a and b that form a right-handed cartesian coordinate system with n. The projection onto the xy plane of a has the same direction as that of n. b is perpendicular to both a and n and always lies in the xy plane. chi then denotes the clockwise (not counterclockwise) angle off the a axis. A value of 0 gives the a axis, and a value of 90° gives the b axis.

Examples

Here is how you can get the x and the y axis from the z axis.

v = rotplane([0 0 1],[0 -pi/2])
v =
    1.0000    0.0000
         0    1.0000
         0         0

Here is a list of 10 vectors in a plane perpendicular to [1 1 1].

v = rotplane([1 1 1],[0 pi],5)
v =
    0.4082    0.7887    0.7071    0.2113   -0.4082
    0.4082   -0.2113   -0.7071   -0.7887   -0.4082
   -0.8165   -0.5774   -0.0000    0.5774    0.8165
See also

ang2vec, erot, eulang, rotaxi2mat, rotmat2axi, vec2ang