diff --git a/CodeR/02_Compute_angles_cone.r b/CodeR/02_Compute_angles_cone.r index 19ea241eff0cb6e4e132fa03f0f5940da0fdd706..79c820acd24b1608c773a493d511d5780be034ab 100644 --- a/CodeR/02_Compute_angles_cone.r +++ b/CodeR/02_Compute_angles_cone.r @@ -25,8 +25,10 @@ library("stringr") library("VoxR") library("data.table") -load("/home/nibio/REPOS/holger_tower_pov/DataR/pan3d.RData") +## load("/home/nibio/REPOS/holger_tower_pov/DataR/pan3d.RData") ## load("/home/pepito/Documents/holger_tower_pov/DataR/pan3d.RData") +load("/home/pepito/Documents/holger_tower_pov/DataR/pan3d.RData") + ## this function scale points coordinate ## between 0 and (max-min) values @@ -66,9 +68,6 @@ dist3d2 <- function(xa, ya, za, xb, yb, zb) { DataR <- paste0("/home/nibio/REPOS/holger_tower_pov/DataR") ## DataR <- paste0("/home/pepito/Documents/holger_tower_pov/DataR") - - - ## plot data - full path DataPaths <- list.files(DataR, ## pattern = "plot_", diff --git a/CodeR/03_Compute_angles_cone.r b/CodeR/03_Compute_angles_cone.r index f6ed4b8868f8ef0db08a87810977b8ba4c38ceb7..af3b3f9515088dc6a70ea7673f98878df1dfbc64 100644 --- a/CodeR/03_Compute_angles_cone.r +++ b/CodeR/03_Compute_angles_cone.r @@ -16,7 +16,6 @@ library("data.table") ## DataR <- paste0("/home/nibio/REPOS/holger_tower_pov/DataR") ## DataR <- paste0("/home/pepito/Documents/holger_tower_pov/DataR") DataR <- paste0("/home/nica/Documents/Holger_tower_pov/DataR") - CodeR <- paste0("/home/nica/Documents/Holger_tower_pov/CodeR") ## @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @@ -37,8 +36,7 @@ Data <- read.las(DataPaths) Data[, 1:3] ## @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ - -## Data <- Data[sample(1:nrow(Data), nrow(Data)*0.10), ] +Data <- Data[sample(1:nrow(Data), nrow(Data)*0.20), ] Data[, X := Scale(Data$X)] Data[, Y := Scale(Data$Y)] Data[, Z := Scale(Data$Z)] @@ -52,14 +50,10 @@ pan3d(3) ## @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ ## Create an artificial tower. Just the corners -## CornA <- data.table(X = 3, Y = 3, Z = 40) +CornA <- data.table(X = 3, Y = 3, Z = 40) ## CornA <- Data[identify3d(Data, n = 1), ] spheres3d(CornA, radius = 1, col = "yellow") - - - - ## Left click on a ground point in the point cloud ## Right click to scape ## CornB <- Data[identify3d(Data, n = 1), ] @@ -85,16 +79,13 @@ Data[, H := dist3d2(X, Y, Z, Data[, Angle := CO/H] Data[, Angle := (asin(Angle))*180/pi] -plot3d(Data[Angle > 28, ], aspect = "iso", size = 0.5, col = "grey21") +plot3d(Data[Angle > 10, ], aspect = "iso", size = 0.5, col = "grey21") spheres3d(CornA, radius = 1, col = "yellow") spheres3d(CornB, radius = 1, col = "red") plot3d(Data[Angle < 28, ], aspect = "iso", size = 0.5, col = "red", add = T) pan3d(3) ## @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ -## Select closest point by angle -Data2 <- Data[Angle < 15, ] -Data2[, min(H), by = Angle]