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
Package Registry
Container Registry
Model registry
Operate
Terraform modules
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Lennard Hofmann
RobotAPI
Commits
c4e24369
Commit
c4e24369
authored
3 years ago
by
Fabian Reister
Browse files
Options
Downloads
Patches
Plain Diff
Arviz Path visu: added points that will be drawn in corners
parent
b7407d85
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/Coin/VisualizationPath.cpp
+37
-3
37 additions, 3 deletions
source/RobotAPI/components/ArViz/Coin/VisualizationPath.cpp
source/RobotAPI/components/ArViz/Coin/VisualizationPath.h
+8
-0
8 additions, 0 deletions
source/RobotAPI/components/ArViz/Coin/VisualizationPath.h
with
45 additions
and
3 deletions
source/RobotAPI/components/ArViz/Coin/VisualizationPath.cpp
+
37
−
3
View file @
c4e24369
#include
"VisualizationPath.h"
#include
"VisualizationPath.h"
#include
<algorithm>
#include
<Inventor/SbVec3f.h>
#include
<Inventor/SbVec3f.h>
#include
<Inventor/nodes/SoCoordinate3.h>
#include
<Inventor/nodes/SoCoordinate3.h>
#include
<Inventor/nodes/SoDrawStyle.h>
#include
<Inventor/nodes/SoDrawStyle.h>
#include
<Inventor/nodes/SoLineSet.h>
#include
<Inventor/nodes/SoLineSet.h>
#include
<Inventor/nodes/SoPointSet.h>
namespace
armarx
::
viz
::
coin
namespace
armarx
::
viz
::
coin
{
{
...
@@ -27,19 +30,36 @@ namespace armarx::viz::coin
...
@@ -27,19 +30,36 @@ namespace armarx::viz::coin
node
->
addChild
(
coordinate3
);
node
->
addChild
(
coordinate3
);
node
->
addChild
(
lineSep
);
node
->
addChild
(
lineSep
);
// points (use the following, if the points should be drawn in a different color)
// pclMat = new SoMaterial;
// SoMaterialBinding* pclMatBind = new SoMaterialBinding;
// pclMatBind->value = SoMaterialBinding::PER_PART;
pclCoords
=
new
SoCoordinate3
;
pclStyle
=
new
SoDrawStyle
;
// node->addChild(pclMat);
// node->addChild(pclMatBind);
node
->
addChild
(
pclCoords
);
node
->
addChild
(
pclStyle
);
node
->
addChild
(
new
SoPointSet
);
}
}
bool
VisualizationPath
::
update
(
ElementType
const
&
element
)
bool
VisualizationPath
::
update
(
ElementType
const
&
element
)
{
{
// set position
// set position
coordinate3
->
point
.
setValuesPointer
(
element
.
points
.
size
(),
reinterpret_cast
<
const
float
*>
(
element
.
points
.
data
()));
coordinate3
->
point
.
setValuesPointer
(
element
.
points
.
size
(),
reinterpret_cast
<
const
float
*>
(
element
.
points
.
data
()));
// set color
// set color
const
auto
lineColor
=
element
.
lineC
olor
;
const
auto
lineColor
=
element
.
c
olor
;
constexpr
float
toUnit
=
1.0
F
/
255.0
F
;
constexpr
float
toUnit
=
1.0
F
/
255.0
F
;
const
auto
color
=
SbVec3f
(
lineColor
.
r
,
lineColor
.
g
,
lineColor
.
b
)
*
toUnit
;
const
auto
color
=
SbVec3f
(
lineColor
.
r
,
lineColor
.
g
,
lineColor
.
b
)
*
toUnit
;
const
float
transparency
=
1.0
F
-
static_cast
<
float
>
(
lineColor
.
a
)
*
toUnit
;
const
float
transparency
=
1.0
F
-
static_cast
<
float
>
(
lineColor
.
a
)
*
toUnit
;
lineMaterial
->
diffuseColor
.
setValue
(
color
);
lineMaterial
->
diffuseColor
.
setValue
(
color
);
...
@@ -58,6 +78,20 @@ namespace armarx::viz::coin
...
@@ -58,6 +78,20 @@ namespace armarx::viz::coin
const
int
pointSize
=
static_cast
<
int
>
(
element
.
points
.
size
());
const
int
pointSize
=
static_cast
<
int
>
(
element
.
points
.
size
());
lineSet
->
numVertices
.
set1Value
(
0
,
pointSize
);
lineSet
->
numVertices
.
set1Value
(
0
,
pointSize
);
// points at each node
// const std::vector<SbVec3f> colorData(element.points.size(), color);
// pclMat->diffuseColor.setValuesPointer(colorData.size(),
// reinterpret_cast<const float*>(colorData.data()));
// pclMat->ambientColor.setValuesPointer(colorData.size(),
// reinterpret_cast<const float*>(colorData.data()));
// pclMat->transparency = transparency;
pclCoords
->
point
.
setValuesPointer
(
element
.
points
.
size
(),
reinterpret_cast
<
const
float
*>
(
element
.
points
.
data
()));
pclStyle
->
pointSize
=
element
.
lineWidth
+
5
;
return
true
;
return
true
;
}
}
}
// namespace armarx::viz::coin
}
// namespace armarx::viz::coin
\ No newline at end of file
This diff is collapsed.
Click to expand it.
source/RobotAPI/components/ArViz/Coin/VisualizationPath.h
+
8
−
0
View file @
c4e24369
...
@@ -39,9 +39,17 @@ namespace armarx::viz::coin
...
@@ -39,9 +39,17 @@ namespace armarx::viz::coin
bool
update
(
ElementType
const
&
element
);
bool
update
(
ElementType
const
&
element
);
/// lines
SoCoordinate3
*
coordinate3
;
SoCoordinate3
*
coordinate3
;
SoDrawStyle
*
lineStyle
;
SoDrawStyle
*
lineStyle
;
SoLineSet
*
lineSet
;
SoLineSet
*
lineSet
;
SoMaterial
*
lineMaterial
;
SoMaterial
*
lineMaterial
;
/// points
// SoMaterial* pclMat;
SoCoordinate3
*
pclCoords
;
SoDrawStyle
*
pclStyle
;
};
};
}
// namespace armarx::viz::coin
}
// namespace armarx::viz::coin
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