Skip to content
Snippets Groups Projects
00_apply_sifFootP.r 1.93 KiB
rm(list=ls())
gc()

## @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
## packages functions
rm(list=ls())

library("rlas")
library("rgl")
library("stringr")
library("VoxR")
library("data.table")

## @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
MyCodeR <- "/home/nica/Documents/Holger_tower_pov/MASTER/FUNCTIONS"
MyDataR <- "/home/nica/Documents/Holger_tower_pov/DataR"

## @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
## load functions
source(paste0(MyCodeR, "/pan3d.r"))
source(paste0(MyCodeR, "/sifFootP.r"))
       
## @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
## plot data - full path
DataPaths <- list.files(MyDataR,
                        pattern = "22_classified.rds",
                        ## pattern = "22_classified.las",
                        full.names = T)

Data <- fst::read_fst(DataPaths, as.data.table = T)
## Data <- read.las(DataPaths)
Data <- Data[, 1:3]

## Use a sample to speed up computations
Data <- Data[sample(1:nrow(Data), nrow(Data)*0.10), ]
gc()

## Very high values of X and Y generate problems when rendering
## the 3d graphics. Center the point cloud
Scale <- function(Vector){
    ((Vector - min(Vector))/
     (max(Vector)-min(Vector)))*
        (max(Vector)-min(Vector))}

Data[, X := Scale(Data$X)]
Data[, Y := Scale(Data$Y)]


## A point at the top of the tower, SW edge 
TopTowerSW <- data.table(X = 173.4451,
                         Y = 104.955,
                         Z = 322.6828)
TopTowerSE <- data.table(X = 175.3196,
                         Y = 105.2212,
                         Z = 322.7785)

## plot3d(Data, aspect = "iso",
##        size = 3, col = "grey21")
## spheres3d(TopTowerSE, radius = 0.3, col = "yellow")
## spheres3d(TopTowerSW, radius = 0.3, col = "red")
## pan3d(3)

## @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
## Compute POV
sifFootP(PointCloud = Data,
         TopTowerP = TopTowerSE,
         thetaDeg = -45)
pan3d(3)