rotate3D | R Documentation |
Rotates the set of 'n' three dimensional points 'x' by the 'p' rotation matrices given by 'A', or by the rotation angles 'ang' around the axes given by 'by'. More than one rotations may be given, either as a [3,3,p] array holding 'p' rotation matrices, a [3,3*p] vertically block divided matrix also holding 'p' rotation matrices, or as 'p' pairs of significant characters "x", "y" and "z" and rotation angles given by 'ang'. When p>1, the output has dimensions [n,3,p], where 'n' is the number of points to be rotated. When paired==TRUE, the output has dimension [n,3].
rotate3D(
x,
by,
ang,
paired = FALSE,
radians = TRUE,
sph.in = FALSE,
sph.out = FALSE,
drop.out = TRUE,
list.out = NULL,
reverse = FALSE
)
x |
is the input given as a matrix of columns representing the x-, y- and z-coordinates (size: [n,3]), or a matrix of rows representing the x-, y- and z-coordinates (size: [3,n]) in which case 'paired' needs to be TRUE, or a list of elements named "x", "y" and "z". |
by |
is a string containing 'q' of the letters 'x', 'y' and 'z', representing the order of the rotations. As an example by="x and y" defines a q=2 xy-rotation (all other letters are discarded). |
ang |
is a vector or matrix of rotation angles. If 'ang' is a vector of length 'lang' and q==1, it is treated as a [lang,1] matrix. If 'ang' is a vector of length 'lang' and q>1, it is transformed in length by the rep(,length.out=q) function to a [1,q] matrix. If 'ang' is a matrix it is, if necessary, transformed in width by the repm() function to a [p,q] matrix. |
paired |
is set to TRUE if each point given by 'x' should be rotated by the corresponding rotation matrix defined by 'A' or by 'by' and 'ang'. If n!=p, the shorter is expanded to the longer. |
radians |
is TRUE if the input angles 'ang' are in radians, and FALSE if degrees are used. |
sph.in |
is TRUE if the input points 'x' are in spherical coordinates. |
sph.out |
is TRUE if the output points should be in spherical coordinates. |
drop.out |
is TRUE if the output should be stripped of empty dimensions by the drop() function. |
list.out |
is FALSE to force array output, TRUE to force list output and NULL to let the nature of the input decide (list giving list output). |
reverse |
is TRUE to reverse the rotation by reversing the order of 'by' and 'ang', and also multiplying 'ang' by -1. |
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.