chullLiDAR3D: 3D convex hull of the individual tree LiDAR-derived point...

Description Usage Arguments Value Author(s) References Examples

View source: R/chullLiDAR3D.r

Description

Compute and plot the 3D convex hull (and its surface area and volume) of the individual tree LiDAR-derived point cloud.

Usage

1
chullLiDAR3D(xyzid,plotit=TRUE,col="forestgreen",alpha=0.8)

Arguments

xyzid

A matrix with four columns (xyz coordinates and tree id).

plotit

Logical. If FALSE, returns only volume and surface area.

col

A vector or a caracter of the convex hull color.

alpha

A vector or a caracter of the convex hull transparency (0-1).

Value

A list with components 'crownvolume' and 'crownsurface', giving the volume and surface of the convex hull.

Author(s)

Carlos Alberto Silva. Uses code by Remko Duursma (YplantQMC package,see "crownhull").

References

http://www.qhull.org and geometry package (see convhulln).

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
# Importing LAS file:
LASfile <- system.file("extdata", "LASexample1.las", package="rLiDAR")

# Reading LAS file
LAS<-readLAS(LASfile,short=TRUE)

# Setring the xyz coordinates and subsetting the data
xyz<-subset(LAS[,1:3],LAS[,3] >= 1.37)

# Finding clusters
clLAS<-kmeans(xyz, 32)

# Set the id vector
id<-as.factor(clLAS$cluster)

#=================================================#
# Example 01
#=================================================#
# Set the alpha
alpha<-0.6

# Set the plotCAS parameter
plotit=TRUE

# Set the convex hull color
col="forestgreen"

# Combining xyz and id
xyzid<-cbind(xyz,id)

# Get the volume and surface area
library(rgl)
open3d() 
volumeList<-chullLiDAR3D(xyzid=xyzid, plotit=plotit, col=col,alpha=alpha)
summary(volumeList) # summary

plot3d(xyzid[,1:3], add=TRUE)   # add the 3D point cloud
axes3d(c("x+", "y-", "z-"))                 # axes
grid3d(side=c('x+', 'y-', 'z'), col="gray") # grid
title3d(xlab = "UTM Easthing", ylab = "UTM Northing",zlab = "Height", col="red")
aspect3d(1,1,0.7) # scale

#=================================================#
# Example 02
#=================================================#
# Set the alpha
alpha<-0.85

# Set the plotCAS parameter
plotit=TRUE

# Set the convex hull color
col=levels(factor(id))

# Combining xyz and id
xyzid<-cbind(xyz,id)

# Get the volume and surface area
open3d() 
volumeList<-chullLiDAR3D(xyzid=xyzid, plotit=plotit, col=col,alpha=alpha)
summary(volumeList)

# Add other plot parameters
plot3d(xyzid[,1:3], col=xyzid[,4], add=TRUE)   # add the 3D point cloud
axes3d(c("x+", "y-", "z-"))                 # axes
grid3d(side=c('x+', 'y-', 'z'), col="gray") # grid
title3d(xlab = "UTM Easthing", ylab = "UTM Northing",zlab = "Height", col="red")
aspect3d(1,1,0.7) # scale

rLiDAR documentation built on Oct. 5, 2021, 9:07 a.m.

Related to chullLiDAR3D in rLiDAR...