Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
R
RobotAPI
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Container Registry
Model registry
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Software
ArmarX
RobotAPI
Commits
53f95bf8
Commit
53f95bf8
authored
4 years ago
by
Raphael Grimm
Browse files
Options
Downloads
Plain Diff
Merge branch 'master' of gitlab.com:ArmarX/RobotAPI
parents
863ae93c
dfc699d0
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
source/RobotAPI/components/ArViz/Client/elements/PointCloud.h
+47
-6
47 additions, 6 deletions
...ce/RobotAPI/components/ArViz/Client/elements/PointCloud.h
source/RobotAPI/components/ArViz/Introspection/json_elements.cpp
+3
-1
3 additions, 1 deletion
...RobotAPI/components/ArViz/Introspection/json_elements.cpp
with
50 additions
and
7 deletions
source/RobotAPI/components/ArViz/Client/elements/PointCloud.h
+
47
−
6
View file @
53f95bf8
...
...
@@ -58,19 +58,21 @@ namespace armarx::viz
p
.
color
=
color
;
return
addPoint
(
p
);
}
PointCloud
&
addPoint
(
float
x
,
float
y
,
float
z
,
const
simox
::
color
::
Color
&
color
)
PointCloud
&
addPoint
(
float
x
,
float
y
,
float
z
,
const
simox
::
Color
&
color
)
{
return
addPoint
(
x
,
y
,
z
,
Color
{
color
});
}
PointCloud
&
addPoint
(
float
x
,
float
y
,
float
z
,
std
::
uint8_t
r
,
std
::
uint8_t
g
,
std
::
uint8_t
b
,
std
::
uint8_t
a
=
255
)
template
<
typename
ColorCoeff
=
int
>
PointCloud
&
addPoint
(
float
x
,
float
y
,
float
z
,
ColorCoeff
r
,
ColorCoeff
g
,
ColorCoeff
b
,
ColorCoeff
a
=
255
)
{
return
addPoint
(
x
,
y
,
z
,
Color
{
r
,
g
,
b
,
a
}
);
return
addPoint
(
x
,
y
,
z
,
simox
::
Color
(
r
,
g
,
b
,
a
)
);
}
PointCloud
&
addPoint
(
float
x
,
float
y
,
float
z
)
{
return
addPoint
(
x
,
y
,
z
,
0
,
0
,
0
,
255
);
return
addPoint
(
x
,
y
,
z
,
simox
::
Color
::
black
(
255
)
)
;
}
PointCloud
&
addPoint
(
float
x
,
float
y
,
float
z
,
std
::
size_t
id
,
int
alpha
=
255
)
...
...
@@ -91,7 +93,7 @@ namespace armarx::viz
std
::
enable_if_t
<
detail
::
has_members_rgba
<
PointT
>
::
value
,
int
>
=
0
>
PointCloud
&
addPoint
(
const
PointT
&
p
)
{
return
addPoint
(
p
.
x
,
p
.
y
,
p
.
z
,
p
.
r
,
p
.
g
,
p
.
b
,
p
.
a
);
return
addPoint
(
p
.
x
,
p
.
y
,
p
.
z
,
simox
::
Color
(
p
.
r
,
p
.
g
,
p
.
b
,
p
.
a
)
)
;
}
template
<
class
PointT
>
...
...
@@ -100,6 +102,8 @@ namespace armarx::viz
return
addPoint
(
p
.
x
,
p
.
y
,
p
.
z
,
color
);
}
/// Draw a point cloud.
template
<
class
PointCloudT
>
PointCloud
&
pointCloud
(
const
PointCloudT
&
cloud
,
bool
checkFinite
=
true
)
{
...
...
@@ -114,6 +118,22 @@ namespace armarx::viz
return
*
this
;
}
/// Draw a point cloud with fixed color.
template
<
class
PointCloudT
>
PointCloud
&
pointCloud
(
const
PointCloudT
&
cloud
,
Color
color
,
bool
checkFinite
=
true
)
{
clear
();
for
(
const
auto
&
p
:
cloud
)
{
if
(
isfinite
(
p
,
checkFinite
))
{
addPoint
(
p
,
color
);
}
}
return
*
this
;
}
/// Draw a point cloud with given indices.
template
<
class
PointCloudT
>
PointCloud
&
pointCloud
(
const
PointCloudT
&
cloud
,
const
std
::
vector
<
int
>&
indices
,
bool
checkFinite
=
true
)
...
...
@@ -121,7 +141,7 @@ namespace armarx::viz
clear
();
for
(
int
i
:
indices
)
{
ARMARX_CHECK_FITS_SIZE
(
i
,
int
(
cloud
.
size
())
)
;
ARMARX_CHECK_FITS_SIZE
(
i
,
cloud
.
size
());
const
auto
&
p
=
cloud
.
at
(
size_t
(
i
));
if
(
isfinite
(
p
,
checkFinite
))
{
...
...
@@ -131,11 +151,32 @@ namespace armarx::viz
return
*
this
;
}
/// Draw a point cloud with given indices and fixed color.
template
<
class
PointCloudT
>
PointCloud
&
pointCloud
(
const
PointCloudT
&
cloud
,
const
std
::
vector
<
int
>&
indices
,
Color
color
,
bool
checkFinite
=
true
)
{
clear
();
for
(
int
i
:
indices
)
{
ARMARX_CHECK_FITS_SIZE
(
i
,
cloud
.
size
());
const
auto
&
p
=
cloud
.
at
(
size_t
(
i
));
if
(
isfinite
(
p
,
checkFinite
))
{
addPoint
(
p
,
color
);
}
}
return
*
this
;
}
PointCloud
&
pointSizeInPixels
(
float
s
)
{
data_
->
pointSizeInPixels
=
s
;
return
*
this
;
}
private
:
template
<
class
PointT
>
...
...
This diff is collapsed.
Click to expand it.
source/RobotAPI/components/ArViz/Introspection/json_elements.cpp
+
3
−
1
View file @
53f95bf8
...
...
@@ -154,8 +154,10 @@ namespace armarx::viz
j
[
"pointSizeInPixels"
]
=
pointCloud
.
pointSizeInPixels
;
j
[
"# Points"
]
=
pointCloud
.
points
.
size
();
j
[
json
::
meta
::
KEY
][
"# Points"
]
=
json
::
meta
::
READ_ONLY
;
j
[
"Points[0:10]"
]
=
ColoredPointList
(
pointCloud
.
points
.
begin
(),
pointCloud
.
points
.
begin
()
+
std
::
min
(
size_t
(
10
),
pointCloud
.
points
.
size
()));
}
void
data
::
from_json
(
const
nlohmann
::
json
&
j
,
ElementPointCloud
&
pointCloud
)
{
...
...
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