# Generating some data
n = 400
xplane = runif(n,0,6)
yplane = runif(n,0,6)
zplane = xplane + 0.8 * yplane + runif(n, 0, 0.1)
plane = data.frame(X = xplane, Y = yplane, Z = zplane)
xhplane = runif(n,5,15)
yhplane = runif(n,0,10)
zhplane = 5 + runif(n, 0, 0.)
hplane = data.frame(X = xhplane, Y = yhplane, Z = zhplane)
tline = 1:n
xline = 0.05*tline
yline = 0.01*tline
zline = 0.02*tline + runif(n, 0, 0.1)
line = data.frame(X = xline, Y = yline, Z = zline)
thline = 1:n
xhline = 0.05*thline + runif(n, 0, 0.05)
yhline = 10 - 0.01*thline + runif(n, 0, 0.05)
zhline = 3 + runif(n, 0, 0.05)
hline = data.frame(X = xhline, Y = yhline, Z = zhline)
tvline = 1:n
xvline = 5 + runif(n, 0, 0.05)
yvline = 5 + runif(n, 0, 0.05)
zvline = 0.02*tline
vline = data.frame(X = xvline, Y = yvline, Z = zvline)
las <- rbind(plane, line, hplane, hline, vline)
las <- LAS(las)
las <- segment_shapes(las, shp_plane(k = 20), "plane")
las <- segment_shapes(las, shp_hplane(k = 20), "hplane")
las <- segment_shapes(las, shp_line(k = 20), "line")
las <- segment_shapes(las, shp_hline(k = 20), "hline")
las <- segment_shapes(las, shp_vline(k = 20), "vline")
#plot(las)
#plot(las, color = "plane")
#plot(las, color = "hplane")
#plot(las, color = "line")
#plot(las, color = "hline")
#plot(las, color = "vline")
Run the code above in your browser using DataLab