getAxis: Axes of point cloud

View source: R/getAxis.R

getAxisR Documentation

Axes of point cloud

Description

Calculates principal component axes of 3D point cloud.

Usage

getAxis(p, ax = 1)

Arguments

p

a 3D point cloud in a KxM matrix

ax

principal component axis to calculate (default = 1)

Details

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.

Value

A matrix of dimension 2xM with initial and ending points of the axis.

Author(s)

Alessio Veneziano

Examples

#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")


AlessioVeneziano/indianaBones documentation built on Nov. 29, 2022, 12:21 a.m.