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
ae0c6c4f
Commit
ae0c6c4f
authored
5 years ago
by
Rainer Kartmann
Browse files
Options
Downloads
Patches
Plain Diff
Add drawColor() for unicolored point cloud.
parent
1c7eb794
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
source/RobotAPI/libraries/core/visualization/DebugDrawerTopic.h
+39
-9
39 additions, 9 deletions
.../RobotAPI/libraries/core/visualization/DebugDrawerTopic.h
with
39 additions
and
9 deletions
source/RobotAPI/libraries/core/visualization/DebugDrawerTopic.h
+
39
−
9
View file @
ae0c6c4f
...
...
@@ -441,10 +441,23 @@ namespace armarx
*/
/**
* @brief Draw a point cloud.
* @brief Draw a
unicolored
point cloud.
*
* `pointCloud` must be iterable (provide `begin()` and `end()`),
* and its elements must have at least members `x, y, z`.
* `pointCloud` must be iterable and its elements must provide members `x, y, z`.
*/
template
<
class
PointCloudT
>
void
drawPointCloud
(
const
VisuID
&
id
,
const
PointCloudT
&
pointCloud
,
const
DrawColor
&
color
,
float
pointSize
=
1.0
f
,
bool
ignoreLengthScale
=
false
);
/**
* @brief Draw a colored point cloud.
*
* `pointCloud` must be iterable and its elements must provide
* members `x, y, z`.
* The color of a point is specified by `colorFunc`, which must be
* a callable taking an element of `pointCloud` and returning its
* color as `armarx::DrawColor`.
...
...
@@ -454,7 +467,8 @@ namespace armarx
const
VisuID
&
id
,
const
PointCloudT
&
pointCloud
,
const
ColorFuncT
&
colorFunc
,
float
pointSize
=
1.0
f
);
float
pointSize
=
1.0
f
,
bool
ignoreLengthScale
=
false
);
// CUSTOM
...
...
@@ -562,9 +576,9 @@ namespace armarx
/// The duration for shortSleep().
std
::
chrono
::
milliseconds
shortSleepDuration
{
100
};
};
template
<
typename
DurationT
>
void
DebugDrawerTopic
::
sleepFor
(
const
DurationT
&
duration
)
...
...
@@ -589,28 +603,44 @@ namespace armarx
}
template
<
class
PointCloudT
>
void
DebugDrawerTopic
::
drawPointCloud
(
const
DebugDrawerTopic
::
VisuID
&
id
,
const
PointCloudT
&
pointCloud
,
const
DrawColor
&
color
,
float
pointSize
,
bool
ignoreLengthScale
)
{
drawPointCloud
(
id
,
pointCloud
,
[
&
color
](
const
auto
&
)
{
return
color
;
},
pointSize
,
ignoreLengthScale
);
}
template
<
class
PointCloudT
,
class
ColorFuncT
>
void
DebugDrawerTopic
::
drawPointCloud
(
const
VisuID
&
id
,
const
PointCloudT
&
pointCloud
,
const
ColorFuncT
&
colorFn
,
float
pointSize
)
float
pointSize
,
bool
ignoreLengthScale
)
{
if
(
!
enabled
())
{
return
;
}
const
float
lf
=
ignoreLengthScale
?
1.0
:
_lengthScale
;
DebugDrawerColoredPointCloud
dd
;
dd
.
points
.
reserve
(
pointCloud
.
size
());
dd
.
pointSize
=
pointSize
;
for
(
const
auto
&
p
:
pointCloud
)
{
dd
.
points
.
push_back
(
DebugDrawerColoredPointCloudElement
{
p
.
x
,
p
.
y
,
p
.
z
,
colorFn
(
p
)
lf
*
p
.
x
,
lf
*
p
.
y
,
lf
*
p
.
z
,
colorFn
(
p
)
});
}
...
...
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