VisualizationEllipsoid.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include "ElementVisualizer.h"
4 
5 #include <RobotAPI/interface/ArViz/Elements.h>
6 
7 #include <Inventor/nodes/SoComplexity.h>
8 #include <Inventor/nodes/SoScale.h>
9 #include <Inventor/nodes/SoSphere.h>
10 
11 namespace armarx::viz::coin
12 {
14  {
15  using ElementType = data::ElementEllipsoid;
16 
18  {
19  complexity = new SoComplexity();
20  complexity->type.setValue(SoComplexity::OBJECT_SPACE);
21  complexity->value.setValue(1.0f);
22 
23  scale = new SoScale;
24 
25  sphere = new SoSphere();
26  // We create a unit sphere and create an ellipsoid through scaling
27  sphere->radius.setValue(1.0f);
28 
29  node->addChild(complexity);
30  node->addChild(scale);
31  node->addChild(sphere);
32  }
33 
34  bool update(ElementType const& element)
35  {
36  scale->scaleFactor.setValue(element.axisLengths.e0, element.axisLengths.e1, element.axisLengths.e2);
37 
38  return true;
39  }
40 
41  SoMaterial* material = nullptr;
42  SoComplexity* complexity = nullptr;
43  SoScale* scale = nullptr;
44  SoSphere* sphere = nullptr;
45  };
46 }
ElementVisualizer.h
armarx::viz::coin::TypedElementVisualization
Definition: ElementVisualizer.h:53
armarx::viz::coin::VisualizationEllipsoid::scale
SoScale * scale
Definition: VisualizationEllipsoid.h:43
armarx::viz::coin::VisualizationEllipsoid::update
bool update(ElementType const &element)
Definition: VisualizationEllipsoid.h:34
armarx::viz::coin::VisualizationEllipsoid::VisualizationEllipsoid
VisualizationEllipsoid()
Definition: VisualizationEllipsoid.h:17
armarx::viz::coin::TypedElementVisualization< SoSeparator >::node
NodeType * node
Definition: ElementVisualizer.h:68
armarx::viz::coin::VisualizationEllipsoid::ElementType
data::ElementEllipsoid ElementType
Definition: VisualizationEllipsoid.h:15
armarx::viz::coin
Definition: ElementVisualizer.cpp:11
armarx::viz::coin::VisualizationEllipsoid::sphere
SoSphere * sphere
Definition: VisualizationEllipsoid.h:44
armarx::viz::coin::VisualizationEllipsoid::complexity
SoComplexity * complexity
Definition: VisualizationEllipsoid.h:42
armarx::viz::coin::VisualizationEllipsoid::material
SoMaterial * material
Definition: VisualizationEllipsoid.h:41
armarx::viz::coin::VisualizationEllipsoid
Definition: VisualizationEllipsoid.h:13