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
03bcd37f
Commit
03bcd37f
authored
1 year ago
by
nicoscattaneo
Browse files
Options
Downloads
Patches
Plain Diff
update repo
parent
5de80af8
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
CodeR/01_test_data_structure.r
+97
-49
97 additions, 49 deletions
CodeR/01_test_data_structure.r
with
97 additions
and
49 deletions
CodeR/01_test_data_structure.r
+
97
−
49
View file @
03bcd37f
rm
(
list
=
ls
())
## @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
## @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@
library
(
"rlas"
)
library
(
"rgl"
)
library
(
"stringr"
)
...
...
@@ -8,10 +8,8 @@ library("VoxR")
library
(
"data.table"
)
## function to scale X, Y and Z
getwd
()
load
(
"/home/nica/Documents/Helge_Tower_POV/DataR/pan3d.RData"
)
objects
()
## load("/home/nica/Documents/Helge_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
...
...
@@ -20,41 +18,44 @@ Scale <- function(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_"
,
DataPaths
<-
list.files
(
paste0
(
"/home/pepito/Documents"
,
"/holger_tower_pov/DataR"
),
## pattern = "plot_",
pattern
=
"Plot_"
,
full.names
=
T
)
## @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
## @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@
## Scale the data to imrpove visualization
Data
<-
read.las
(
DataPaths
)
gc
()
## Data <- Data[sample(1:nrow(Data), nrow(Data)*0.20), ]
Data
<-
Data
[
Classification
%in%
c
(
3
,
4
,
5
),
]
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
s
atificial tower. Just the corners
CornA
<-
data.table
(
X
=
1
,
Y
=
1
,
Z
=
4
0
)
CornB
<-
data.table
(
X
=
1
,
Y
=
-
1
,
Z
=
4
0
)
CornC
<-
data.table
(
X
=
-
1
,
Y
=
1
,
Z
=
4
0
)
CornD
<-
data.table
(
X
=
-
1
,
Y
=
-
1
,
Z
=
4
0
)
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
##
plot3d(Data, aspect = "iso", size = 0.
5
)
## @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@
## Create an a
r
tificial tower. Just the corners
CornA
<-
data.table
(
X
=
3
,
Y
=
3
,
Z
=
5
0
)
CornB
<-
data.table
(
X
=
3
,
Y
=
-
3
,
Z
=
5
0
)
CornC
<-
data.table
(
X
=
-
3
,
Y
=
3
,
Z
=
5
0
)
CornD
<-
data.table
(
X
=
-
3
,
Y
=
-
3
,
Z
=
5
0
)
spheres3d
(
CornA
,
radius
=
1
,
col
=
"yellow"
)
spheres3d
(
CornB
,
radius
=
1
,
col
=
"blue"
)
spheres3d
(
CornC
,
radius
=
1
,
col
=
"red"
)
spheres3d
(
CornD
,
radius
=
1
,
col
=
"green"
)
## @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@
## center the data around corner
X
Data2
<-
copy
(
Data
)
Data2
[,
X
:=
X
-
CornA
$
X
]
Data2
[,
Y
:=
Y
-
CornA
$
Y
]
...
...
@@ -63,34 +64,81 @@ 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"
)
##
plot3d(Data2, aspect = "iso", size = 0.2, col= "red")
##
spheres3d(c(0, 0, 40), radius =
1
, col = "yellow")
## @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
## compute angles on the plane.
## It should be from >180 dgrees to <90 dgrees.
## points should be selected 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"
)
## plot3d(Data2, aspect = "iso", size = 0.2, col= "red")
## spheres3d(c(0, 0, 40), radius = 1, 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")
## plot3d(Data2[angle_x %inrange% list(270.1, 359.9), ], aspect = "iso", size = 0.7,
## col= "black", add = T)
Data3
<-
Data2
[
angle_x
%inrange%
list
(
0
,
180
),
]
Data2
<-
rbind
(
Data3
,
Data2
[
angle_x
%inrange%
list
(
270.1
,
359.9
),
])
rm
(
Data3
)
gc
()
## plot3d(Data2, aspect = "iso", size = 0.2,
## col= "grey21")
## spheres3d(c(0, 0, 40), radius = 1, col = "yellow")
## @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
## Compute angles around the Z axis
Data2
[,
angle_x
:=
NULL
]
Data2
[,
z
:=
z
-
CornA2
$
Z
]
Data2
[,
angle_z
:=
VoxR
::
axis_angle
(
Data2
,
axis
=
"Z"
)]
Data2
[,
z
:=
z
+
CornA2
$
Z
]
Data2
[,
angle_z
:=
angle_z
-
90
]
Data2
[,
angle_x
:=
VoxR
::
axis_angle
(
Data2
,
axis
=
"X"
,
project
=
"xy"
)]
## FOV
VerticalOpen
<-
28
## VerticalOpen <- 10
OrizontalOpen
<-
40
##
VertcalAngle
<-
50
HorizAngle
<-
90
plot3d
(
Data2
,
aspect
=
"iso"
,
size
=
0.2
,
col
=
"grey21"
)
spheres3d
(
c
(
0
,
0
,
40
),
radius
=
1
,
col
=
"yellow"
)
plot3d
(
Data2
[
angle_z
<
(
90
-
VertcalAngle
)
+
VerticalOpen
&
angle_z
>
((
90
-
VertcalAngle
))
&
angle_x
<
HorizAngle
+
OrizontalOpen
&
angle_x
>
HorizAngle
,
],
aspect
=
"iso"
,
size
=
0.7
,
col
=
"red"
,
add
=
T
)
pan3d
(
2
)
## @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
plot3d
(
Data2
,
aspect
=
"iso"
,
size
=
0.2
,
col
=
"grey21"
)
spheres3d
(
c
(
0
,
0
,
40
),
radius
=
0.5
,
col
=
"yellow"
)
for
(
HorizAngle
in
c
(
seq
(
0
,
179.9
,
10
),
seq
(
270.1
,
360
,
10
))){
plot3d
(
Data2
[
angle_z
<
(
90
-
VertcalAngle
)
+
VerticalOpen
&
angle_z
>
((
90
-
VertcalAngle
))
&
angle_x
<
HorizAngle
+
OrizontalOpen
&
angle_x
>
HorizAngle
,
],
aspect
=
"iso"
,
size
=
0.7
,
col
=
"red"
,
add
=
T
)
Sys.sleep
(
0.3
)
rgl.pop
()
}
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