Learn R Programming

VoxR (version 0.5.1)

axis.distance: Computing distance of points from an axis

Description

Computing distance of points with an axis (x, y or z) and the origin of the 3d Cartesian coordinate system.

Usage

axis.distance(data, axis)

Arguments

data
a data frame containing the x, y, z, ... coordinates of a point cloud
axis
character string specifying the reference axis to compute the distances : "X", "Y" or "Z"

Value

A vector countaining the distance values of the points.

Details

Default : proportion = FALSE

See Also

point.distance and axis.angle

Examples

Run this code
data(treecloud_vox)

#- computing distances

dist <- axis.distance(treecloud_vox,axis="Z")
treecloud_vox[,4] <- dist

#-density plot

plot(density(dist,na.rm=TRUE))

#-visualisation

z <- c(sort(unique(round(treecloud_vox[,4],digits=2)),decreasing=TRUE))
col <- rainbow(n=length(z),start=0,end=2/6)
require(rgl)
library(rgl)
open3d()
for(i in 1:length(z)){
  a <- subset(treecloud_vox,round(treecloud_vox[,4],digits=2)==z[i])
  plot3d(a,col=col[i],add=TRUE)}

Run the code above in your browser using DataLab