Skip to content
Snippets Groups Projects
Commit 5de80af8 authored by Nicolas Cattaneo's avatar Nicolas Cattaneo
Browse files

update repo

parent 5fd3436d
No related branches found
No related tags found
No related merge requests found
/DataR/
rm(list=ls())
## @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
library("rlas")
library("rgl")
library("stringr")
library("VoxR")
library("data.table")
## function to scale X, Y and Z
getwd()
load("/home/nica/Documents/Helge_Tower_POV/DataR/pan3d.RData")
objects()
## this function scale points coordinate
## between 0 and (max-min) values
Scale <- function(Vector){
((Vector - min(Vector))/
(max(Vector)-min(Vector)))*
(max(Vector)-min(Vector))}
## @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
## plot data - full path
DataPaths <- list.files("/home/nica/Documents/Helge_Tower_POV/DataR",
pattern = "plot_",
full.names = T)
## @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
## Scale the data to imrpove visualization
Data <- read.las(DataPaths)
gc()
Data[, X := Scale(Data$X)]
Data[, Y := Scale(Data$Y)]
Data[, Z := Scale(Data$Z)]
## @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
## center the data around 0
Data[, X := X-mean(X)]
Data[, Y := Y-mean(Y)]
plot3d(Data, aspect = "iso", size = 0.2)
## @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
## Create an satificial tower. Just the corners
CornA <- data.table(X = 1, Y = 1, Z = 40)
CornB <- data.table(X = 1, Y = -1, Z = 40)
CornC <- data.table(X = -1, Y = 1, Z = 40)
CornD <- data.table(X = -1, Y = -1, Z = 40)
spheres3d(CornA, radius = 0.3, col = "yellow")
spheres3d(CornB, radius = 0.3, col = "blue")
spheres3d(CornC, radius = 0.3, col = "red")
spheres3d(CornD, radius = 0.3, col = "green")
## @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
## center the data around cornerX
Data2 <- copy(Data)
Data2[, X := X - CornA$X]
Data2[, Y := Y - CornA$Y]
CornA2 <- copy(CornA)
CornA2[, X := X - CornA$X]
CornA2[, Y := Y - CornA$Y]
plot3d(Data2, aspect = "iso", size = 0.2, col= "red")
spheres3d(c(0, 0, 40), radius = 0.3, col = "yellow")
## @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
## compute angles on the plane.
## It should be from >180 dgrees to <90 dgrees.
## you must voxelize the point cloud first.
Data2 <- vox(Data2, 0.02)
plot3d(Data2, aspect = "iso", size = 0.2, col= "red")
spheres3d(c(0, 0, 40), radius = 0.3, col = "yellow")
## Data2[, npts := NULL]
## Data2[, angle_x := VoxR::axis_angle(Data2, axis = "X",
## project = "xy")]
plot3d(Data2[angle_x %inrange% list(0, 180), ], aspect = "iso", size = 0.7,
col= "black", add = T)
plot3d(Data2[angle_x %inrange% list(270.1, 359.9), ], aspect = "iso", size = 0.7,
col= "black", add = T)
spheres3d(c(0, 0, 40), radius = 0.3, col = "yellow")
summary(Data2$angle_x)
spheres3d(c(0, 0, 40), radius = 0.3, col = "yellow")
rm(list=ls())
## @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
library("rlas")
library("rgl")
library("stringr")
library("VoxR")
library("data.table")
## function to scale X, Y and Z
getwd()
load("/home/nica/Documents/Helge_Tower_POV/DataR/pan3d.RData")
objects()
## this function scale points coordinate
## between 0 and (max-min) values
Scale <- function(Vector){
((Vector - min(Vector))/
(max(Vector)-min(Vector)))*
(max(Vector)-min(Vector))}
## @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
## plot data - full path
DataPaths <- list.files("/home/nica/Documents/Helge_Tower_POV/DataR",
pattern = "plot_",
full.names = T)
## @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
## Scale the data to imrpove visualization
Data <- read.las(DataPaths)
gc()
Data[, X := Scale(Data$X)]
Data[, Y := Scale(Data$Y)]
Data[, Z := Scale(Data$Z)]
## @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
## center the data around 0
Data[, X := X-mean(X)]
Data[, Y := Y-mean(Y)]
## plot3d(Data, aspect = "iso", size = 0.2)
## @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
## Create an satificial tower. Just the corners
CornA <- data.table(X = 2, Y = 2, Z = 40)
CornB <- data.table(X = 2, Y = -2, Z = 40)
CornC <- data.table(X = -2, Y = 2, Z = 40)
CornD <- data.table(X = -2, Y = -2, Z = 40)
spheres3d(CornA, radius = 0.3, col = "yellow")
spheres3d(CornB, radius = 0.3, col = "yellow")
spheres3d(CornC, radius = 0.3, col = "yellow")
spheres3d(CornD, radius = 0.3, col = "yellow")
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment