getAxis | R Documentation |
Calculates principal component axes of 3D point cloud.
getAxis(p, ax = 1)
p |
a 3D point cloud in a KxM matrix |
ax |
principal component axis to calculate (default = 1) |
findAxis
uses the function princomp
to calculate the major axes of a 2D or 3D point cloud.
The axis specifies if the first (ax = 1), second (ax = 2) or third (ax = 3) principal component axis is calculated.
A matrix of dimension 2xM with initial and ending points of the axis.
Alessio Veneziano
#Calculate and plot principal axes of 3D point cloud x<-rnorm(1000,0,0.1) y<-rnorm(1000,0,0.2) z<-x+rnorm(1000,0,0.3) p<-cbind(x,y,z) a1<-getAxis(p,1) a2<-getAxis(p,2) a3<-getAxis(p,3) require(rgl) points3d(p) lines3d(a1,col="red") lines3d(a2,col="blue") lines3d(a3,col="green")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.