5 #include <RobotAPI/interface/ArViz/Elements.h>
6 #include <VirtualRobot/Visualization/CoinVisualization/CoinVisualizationFactory.h>
7 #include <Inventor/nodes/SoAsciiText.h>
8 #include <Inventor/nodes/SoCube.h>
9 #include <Inventor/nodes/SoSeparator.h>
10 #include <Inventor/nodes/SoTransform.h>
11 #include <Inventor/nodes/SoTranslation.h>
23 for (
int i = 0; i < 3; i++)
25 SoTransform* t =
new SoTransform();
26 SoMaterial* m =
new SoMaterial();
30 SoCube*
c =
new SoCube();
31 SoCube* c2 =
new SoCube();
32 SoTransform* t2 =
new SoTransform();
37 SoSeparator* tmp1 =
new SoSeparator();
43 SoSeparator* tmp2 =
new SoSeparator();
44 SoMaterial* m2 =
new SoMaterial();
45 m2->diffuseColor.setValue(1.0f, 1.0f, 1.0f);
57 SoSeparator* textSep =
new SoSeparator();
58 SoTranslation* moveT =
new SoTranslation();
59 moveT->translation.setValue(2.0f, 2.0f, 0.0f);
60 textSep->addChild(moveT);
64 node->addChild(textSep);
69 const float axisSize = 3.0f;
70 const float axisLength = 100.0f;
75 float blockSize = axisSize + 0.5f;
76 float blockWidth = 0.1f;
80 blockSize += axisSize / 10.0f;
81 blockWidth += axisSize / 10.0f;
84 float axisBlockTranslation = axisLength / numberOfBlocks;
86 for (
int i = 0; i < 3; i++)
88 SoTransform* t =
t_[i];
89 SoMaterial* m =
m_[i];
91 float translation = (axisLength / 2.0f + axisSize / 2.0f) * scaling;
94 m->diffuseColor.setValue(1.0f, 0, 0);
95 t->translation.setValue(translation, 0, 0);
99 m->diffuseColor.setValue(0, 1.0f, 0);
100 t->translation.setValue(0, translation, 0);
104 m->diffuseColor.setValue(0, 0, 1.0f);
105 t->translation.setValue(0, 0, translation);
110 SoTransform* t2 =
t2_[i];
114 c->width = axisLength * scaling;
115 c->height = axisSize * scaling;
116 c->depth = axisSize * scaling;
117 c2->width = blockWidth * scaling;
118 c2->height = blockSize * scaling;
119 c2->depth = blockSize * scaling;
120 t2->translation.setValue(axisBlockTranslation * scaling, 0, 0);
124 c->height = axisLength * scaling;
125 c->width = axisSize * scaling;
126 c->depth = axisSize * scaling;
127 c2->width = blockSize * scaling;
128 c2->height = blockWidth * scaling;
129 c2->depth = blockSize * scaling;
130 t2->translation.setValue(0, axisBlockTranslation * scaling, 0);
134 c->depth = axisLength * scaling;
135 c->height = axisSize * scaling;
136 c->width = axisSize * scaling;
137 c2->width = blockSize * scaling;
138 c2->height = blockSize * scaling;
139 c2->depth = blockWidth * scaling;
140 t2->translation.setValue(0, 0, axisBlockTranslation * scaling);
144 textNode->string.setValue(element.id.c_str());
150 std::array<SoTransform*, 3>
t_;
151 std::array<SoMaterial*, 3>
m_;
152 std::array<SoCube*, 3>
c_;
153 std::array<SoCube*, 3>
c2_;
154 std::array<SoTransform*, 3>
t2_;