17 #include <Inventor/C/errors/debugerror.h>
18 #include <Inventor/nodes/SoMaterial.h>
19 #include <Inventor/nodes/SoSeparator.h>
20 #include <Inventor/nodes/SoCylinder.h>
21 #include <Inventor/nodes/SoCone.h>
22 #include <Inventor/nodes/SoTranslation.h>
23 #include <Inventor/nodes/SoRotationXYZ.h>
24 #include <Inventor/nodes/SoSphere.h>
33 SoSeparator * attachsep);
60 SoSeparator * attachsep,
83 : theclass(tc), materialXAxis(xmat), materialYAxis(ymat), materialZAxis(zmat), attachSep(as), shown(false),
84 origo(SbVec3f(0,0,0)), axislength(1), relaxisthick(0.1),
85 sep(0), overall_translation(0), alternative_Sphere(0), singleaxis_sep(0), singleaxis_cyl(0),
86 singleaxis_cone(0), singleaxis_cyltranslation(0), singleaxis_conetranslation(0)
99 theclass->messageVerbose(
"Building 3D objects");
100 sep =
new SoSeparator;
sep->ref();
102 singleaxis_sep =
new SoSeparator; singleaxis_sep->ref();
103 singleaxis_cyltranslation =
new SoTranslation; singleaxis_sep->addChild(singleaxis_cyltranslation);
104 singleaxis_cyl =
new SoCylinder; singleaxis_sep->addChild(singleaxis_cyl);
105 singleaxis_conetranslation =
new SoTranslation; singleaxis_sep->addChild(singleaxis_conetranslation);
106 singleaxis_cone =
new SoCone; singleaxis_sep->addChild(singleaxis_cone);
108 overall_translation =
new SoTranslation;
110 sep->addChild(overall_translation);
112 #if defined BUILDVP1LIGHT
118 if (alternativeRep) {
119 sep->addChild(materialXAxis);
120 alternative_Sphere =
new SoSphere;
121 sep->addChild(alternative_Sphere);
126 sep->addChild(materialYAxis);
127 sep->addChild(singleaxis_sep);
129 SoRotationXYZ * rotx =
new SoRotationXYZ;
131 rotx->angle.setValue(-0.5*
M_PI);
134 sep->addChild(materialXAxis);
135 sep->addChild(singleaxis_sep);
138 SoRotationXYZ * rotz =
new SoRotationXYZ;
140 rotz->angle.setValue(0.5*
M_PI);
143 sep->addChild(materialZAxis);
144 sep->addChild(singleaxis_sep);
152 ensureInit3DObjects();
153 theclass->messageVerbose(
"Updating fields");
155 const bool save =
sep->enableNotify(
false);
157 const double cylradius = relaxisthick*fabs(axislength);
158 const double coneradius = 1.5*cylradius;
159 const double coneheight = 2.0*coneradius;
160 overall_translation->translation.setValue(origo);
162 if (alternative_Sphere) {
163 alternative_Sphere->radius.setValue(fabs(axislength));
165 singleaxis_cyltranslation->translation.setValue(0.0,(axislength<0?0.0:0.5*fabs(axislength))-0.5*coneheight,0.0);
166 singleaxis_cyl->radius.setValue(cylradius);
167 singleaxis_cyl->height.setValue( (axislength<0 ? 2.0 : 1.0) * fabs(axislength) - coneheight );
168 singleaxis_conetranslation->translation.setValue(0.0,(axislength<0?1.0:0.5)*fabs(axislength),0.0);
169 singleaxis_cone->bottomRadius.setValue(coneradius);
170 singleaxis_cone->height.setValue(coneheight);
174 sep->enableNotify(
true);