LASfile <- system.file("extdata", "dbh.laz", package="lidR")
las <- readTLS(LASfile, select = "xyz")
xyz = sf::st_coordinates(las)
circle = fit_circle(xyz)
plot(xyz, asp = 1, pch = 19, cex = 0.1)
symbols(circle$center_x, circle$center_y, circles = circle$radius,
add = TRUE, fg = "red", inches = FALSE)
trunk = las[circle$inliers]
# Fitting a half-circle
half = xyz[xyz[,1] > 101.45,]
circle = fit_circle(half)
plot(half, asp = 1, pch = 19, cex = 0.1)
symbols(circle$center_x, circle$center_y, circles = circle$radius,
add = TRUE, fg = "red", inches = FALSE)
circle$covered_arc_degree
Run the code above in your browser using DataLab