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
4ae39d00
Commit
4ae39d00
authored
6 years ago
by
Mirko Wächter
Browse files
Options
Downloads
Patches
Plain Diff
added convenience function for drawing trishmeshes from simox in debugdrawer
parent
b849d975
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/DebugDrawer/CMakeLists.txt
+3
-1
3 additions, 1 deletion
source/RobotAPI/components/DebugDrawer/CMakeLists.txt
source/RobotAPI/components/DebugDrawer/DebugDrawerUtils.h
+80
-0
80 additions, 0 deletions
source/RobotAPI/components/DebugDrawer/DebugDrawerUtils.h
with
83 additions
and
1 deletion
source/RobotAPI/components/DebugDrawer/CMakeLists.txt
+
3
−
1
View file @
4ae39d00
...
...
@@ -19,7 +19,9 @@ endif()
set
(
COMPONENT_LIBS ArmarXCore RobotAPIInterfaces RobotAPICore
${
Simox_LIBRARIES
}
)
set
(
SOURCES DebugDrawerComponent.cpp
)
set
(
HEADERS DebugDrawerComponent.h
)
set
(
HEADERS DebugDrawerComponent.h
DebugDrawerUtils.h
)
armarx_add_component
(
"
${
SOURCES
}
"
"
${
HEADERS
}
"
)
This diff is collapsed.
Click to expand it.
source/RobotAPI/components/DebugDrawer/DebugDrawerUtils.h
0 → 100644
+
80
−
0
View file @
4ae39d00
/*
* This file is part of ArmarX.
*
* Copyright (C) 2011-2017, High Performance Humanoid Technologies (H2T), Karlsruhe Institute of Technology (KIT), all rights reserved.
*
* ArmarX is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* ArmarX is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @package ArmarX
* @author Mirko Waechter( mirko.waechter at kit dot edu)
* @date 2018
* @copyright http://www.gnu.org/licenses/gpl-2.0.txt
* GNU General Public License
*/
#pragma once
#include
<VirtualRobot/Visualization/TriMeshModel.h>
#include
<RobotAPI/interface/visualization/DebugDrawerInterface.h>
#include
<Eigen/Core>
namespace
armarx
{
class
DebugDrawerUtils
{
public:
static
DebugDrawerTriMesh
convertTriMesh
(
const
VirtualRobot
::
TriMeshModel
&
trimesh
)
{
DebugDrawerTriMesh
ddMesh
;
auto
addVertex
=
[
&
](
const
Eigen
::
Vector3f
&
v
)
{
ddMesh
.
vertices
.
push_back
({
v
(
0
),
v
(
1
),
v
(
2
)});
return
(
int
)
ddMesh
.
vertices
.
size
()
-
1
;
};
auto
addColor
=
[
&
](
const
VirtualRobot
::
VisualizationFactory
::
Color
&
c
)
{
ddMesh
.
colors
.
push_back
(
DrawColor
{
c
.
r
,
c
.
g
,
c
.
b
,
c
.
transparency
});
return
(
int
)
ddMesh
.
colors
.
size
()
-
1
;
};
ddMesh
.
faces
.
reserve
(
trimesh
.
faces
.
size
());
ddMesh
.
vertices
.
reserve
(
trimesh
.
vertices
.
size
());
ddMesh
.
colors
.
reserve
(
trimesh
.
colors
.
size
());
for
(
auto
&
f
:
trimesh
.
faces
)
{
DebugDrawerFace
f2
;
f2
.
vertex1
.
vertexID
=
addVertex
(
trimesh
.
vertices
.
at
(
f
.
id1
));
f2
.
vertex2
.
vertexID
=
addVertex
(
trimesh
.
vertices
.
at
(
f
.
id2
));
f2
.
vertex3
.
vertexID
=
addVertex
(
trimesh
.
vertices
.
at
(
f
.
id3
));
if
(
f
.
idNormal1
!=
UINT_MAX
)
{
f2
.
vertex1
.
normalID
=
addVertex
(
trimesh
.
normals
.
at
(
f
.
idNormal1
));
f2
.
vertex2
.
normalID
=
addVertex
(
trimesh
.
normals
.
at
(
f
.
idNormal2
));
f2
.
vertex3
.
normalID
=
addVertex
(
trimesh
.
normals
.
at
(
f
.
idNormal3
));
}
else
{
// f2.vertex1.normalID = f2.vertex2.normalID = f2.vertex3.normalID = addVertex(f.normal);
f2
.
normal
=
{
f
.
normal
.
x
(),
f
.
normal
.
y
(),
f
.
normal
.
z
()};
}
f2
.
vertex1
.
colorID
=
addColor
(
trimesh
.
colors
.
at
(
f
.
idColor1
));
f2
.
vertex2
.
colorID
=
addColor
(
trimesh
.
colors
.
at
(
f
.
idColor2
));
f2
.
vertex3
.
colorID
=
addColor
(
trimesh
.
colors
.
at
(
f
.
idColor3
));
ddMesh
.
faces
.
push_back
(
f2
);
}
return
ddMesh
;
}
};
}
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