Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
H
Holger_Tower_POV
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Nicolas Cattaneo
Holger_Tower_POV
Commits
c44d555d
Commit
c44d555d
authored
1 year ago
by
nicoscattaneo
Browse files
Options
Downloads
Patches
Plain Diff
update repo
parent
08561efe
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
CodeR/02_Compute_angles_cone.r
+35
-18
35 additions, 18 deletions
CodeR/02_Compute_angles_cone.r
with
35 additions
and
18 deletions
CodeR/02_Compute_angles_cone.r
+
35
−
18
View file @
c44d555d
...
...
@@ -11,12 +11,10 @@ gc()
## "share=databank/Prosjekter",
## "/51160_IMPRINT/Forest_projections",
## "/DataR/to_map/merged_22_classified.las")
Dest
<-
"/home/nibio/DATA"
##
Dest <- "/home/nibio/DATA"
## cmd <- paste("cp", Origin, Dest)
## system(cmd)
## REMOVE FILE FROM ORIGIN!
## @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
rm
(
list
=
ls
())
...
...
@@ -26,7 +24,8 @@ library("stringr")
library
(
"VoxR"
)
library
(
"data.table"
)
load
(
"/home/pepito/Documents/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")
## this function scale points coordinate
## between 0 and (max-min) values
...
...
@@ -36,36 +35,43 @@ Scale <- function(Vector){
(
max
(
Vector
)
-
min
(
Vector
))}
## @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
## DataR
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
(
paste0
(
"/home/pepito/Documents"
,
"/holger_tower_pov/DataR"
),
pattern
=
"plot_"
,
DataPaths
<-
list.files
(
DataR
,
## pattern = "plot_",
## pattern = "Plot_",
## pattern = "merg",
pattern
=
".rds"
,
full.names
=
T
)
Data
<-
read.las
(
DataPaths
)
Data
<-
Data
[
sample
(
1
:
nrow
(
Data
),
nrow
(
Data
)
*
0.20
),
]
## Data <- read.las(DataPaths)
## Data[, 1:3]
Data
<-
fst
::
read_fst
(
DataPaths
,
as.data.table
=
T
)
Data
<-
Data
[
sample
(
1
:
nrow
(
Data
),
nrow
(
Data
)
*
0.02
),
]
Data
[,
X
:=
Scale
(
Data
$
X
)]
Data
[,
Y
:=
Scale
(
Data
$
Y
)]
Data
[,
Z
:=
Scale
(
Data
$
Z
)]
Data
[,
X
:=
X
-
mean
(
X
)]
Data
[,
Y
:=
Y
-
mean
(
Y
)]
Data
<-
Data
[,
1
:
3
]
## open3d()
Data
<-
Data
[
Classification
!=
2
,]
plot3d
(
Data
,
aspect
=
"iso"
,
size
=
0.5
)
pan3d
(
3
)
## @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
## Create an artificial tower. Just the corners
## CornA <- data.table(X = 3, Y = 3, Z = 40)
CornA
<-
Data
[
identify3d
(
Data
,
n
=
1
),
]
##
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
),
]
##
CornB <- Data[identify3d(Data, n = 1), ]
spheres3d
(
CornB
,
radius
=
1
,
col
=
"red"
)
## rgl.pop()
...
...
@@ -97,9 +103,10 @@ Data[, Dista := dist3d(X, Y, Z,
setnames
(
Data
,
"Dista"
,
"CO"
)
## plot3d(Data, aspect = "iso", size = 0.5, col = "grey21")
## plot3d(Data[CO <
2
, ], aspect = "iso", size = 4, col = "red", add = T)
## plot3d(Data[CO <
5
, ], aspect = "iso", size = 4, col = "red", add = T)
## spheres3d(CornA, radius = 1, col = "yellow")
## spheres3d(CornB, radius = 1, col = "red")
## pan3d(3)
dist3d2
<-
function
(
xa
,
ya
,
za
,
xb
,
yb
,
zb
)
{
d
<-
sqrt
(((
xa
-
xb
)
^
2
)
+
((
ya
-
yb
)
^
2
)
+
((
za
-
zb
)
^
2
))
return
(
d
)}
...
...
@@ -108,11 +115,21 @@ Data[, H := dist3d2(X, Y, Z,
CornA
$
X
,
CornA
$
Y
,
CornA
$
Z
),
by
=
seq_len
(
nrow
(
Data
))]
## plot3d(Data2, aspect = "iso", size = 4, col = "red", add = T)
## spheres3d(CornA, radius = 1, col = "yellow")
## spheres3d(CornB, radius = 1, col = "red")
Data
[,
Angle
:=
CO
/
H
]
Data
[,
Angle
:=
(
asin
(
Angle
))
*
180
/
pi
]
plot3d
(
Data
[
Angle
<
7
,
],
aspect
=
"iso"
,
size
=
4
,
col
=
"red"
,
add
=
T
)
plot3d
(
Data
[
Angle
>
28
,
],
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
]
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment