ATLAS Offline Software
Loading...
Searching...
No Matches
SoLAr Class Reference

SoLAr - Inventor version of the G4Cons Geant Geometry entity. More...

#include <SoLAr.h>

Inheritance diagram for SoLAr:
Collaboration diagram for SoLAr:

Public Member Functions

 SoLAr ()
 Constructor, required.
virtual void generateAlternateRep ()
 Generate AlternateRep, required.
virtual void clearAlternateRep ()
 We better be able to clear it, too!

Static Public Member Functions

static void initClass ()
 Class Initializer, required.

Public Attributes

SoMFFloat fRmin
 Inside radii.
SoMFFloat fRmax
 Outside radii.
SoMFFloat fDz
 Z Positions.
SoSFFloat fSPhi
 Starting angle, in radians.
SoSFFloat fDPhi
 Delta-angle, in radians.
SoSFBool smoothDraw
 An Inventor option - slightly better render, worse performance.
SoSFInt32 pOverrideNPhi
 Override number of phi subdivision used for rendering shape (i.e.
SoSFNode alternateRep
 Alternate rep required - for use by users without HEPVis shared objects.

Protected Member Functions

virtual void computeBBox (SoAction *action, SbBox3f &box, SbVec3f &center)
 compute bounding Box, required
virtual void generatePrimitives (SoAction *action)
 Generate Primitives, required.
virtual SoChildList * getChildren () const
 GetChildList, required whenever the class has hidden children.

Private Member Functions

 SO_NODE_HEADER (SoLAr)
void generateChildren ()
 Generate Children.
void updateChildren ()
 Used to modify hidden children when a data field is changed.
void inc (double &sinPhi, double &cosPhi, double sinDeltaPhi, double cosDeltaPhi) const
 help with trigonometry. increments sines an cosines by an angle.

Private Attributes

std::unique_ptr< SoChildList > m_children
 ChildList. Required whenever the class has hidden children.

Detailed Description

SoLAr - Inventor version of the G4Cons Geant Geometry entity.

Node: SoLAr

Description: The Inventor version of the G4Cons Geant Geometry entity

Author: Joe Boudreau Nov 2004

Definition at line 39 of file SoLAr.h.

Constructor & Destructor Documentation

◆ SoLAr()

SoLAr::SoLAr ( )

Constructor, required.

Definition at line 35 of file SoLAr.cxx.

35 {
36 // This statement is required
37 SO_NODE_CONSTRUCTOR(SoLAr);
38
39 // Data fields are initialized like this:
40 SO_NODE_ADD_FIELD(fRmin, (0.0));
41 SO_NODE_ADD_FIELD(fRmax, (0.0));
42 SO_NODE_ADD_FIELD(fDz, (0.0));
43 SO_NODE_ADD_FIELD(fSPhi, (0.0));
44 SO_NODE_ADD_FIELD(fDPhi, ((float)(2*M_PI)));
45 SO_NODE_ADD_FIELD(smoothDraw, (TRUE));
46 SO_NODE_ADD_FIELD(pOverrideNPhi, (0));
47 SO_NODE_ADD_FIELD(alternateRep, (NULL));
48 m_children = std::make_unique<SoChildList>(this);
49
50 float rMinDef[]={10.0, 15.0, 10.0};
51 float rMaxDef[]={11.0, 17.0, 12.0};
52 float zDef []={-10.0, 0.0, 10.0};
53
54 fRmin.setValues(0,2,rMinDef);
55 fRmax.setValues(0,2,rMaxDef);
56 fDz.setValues(0,2,zDef);
57 setNodeType(EXTENSION);
58}
#define M_PI
SoSFInt32 pOverrideNPhi
Override number of phi subdivision used for rendering shape (i.e.
Definition SoLAr.h:74
SoLAr()
Constructor, required.
Definition SoLAr.cxx:35
SoSFBool smoothDraw
An Inventor option - slightly better render, worse performance.
Definition SoLAr.h:69
std::unique_ptr< SoChildList > m_children
ChildList. Required whenever the class has hidden children.
Definition SoLAr.h:138
SoMFFloat fDz
Z Positions.
Definition SoLAr.h:57
SoSFFloat fSPhi
Starting angle, in radians.
Definition SoLAr.h:61
SoMFFloat fRmin
Inside radii.
Definition SoLAr.h:49
SoSFFloat fDPhi
Delta-angle, in radians.
Definition SoLAr.h:65
SoSFNode alternateRep
Alternate rep required - for use by users without HEPVis shared objects.
Definition SoLAr.h:78
SoMFFloat fRmax
Outside radii.
Definition SoLAr.h:53

Member Function Documentation

◆ clearAlternateRep()

void SoLAr::clearAlternateRep ( )
virtual

We better be able to clear it, too!

Definition at line 500 of file SoLAr.cxx.

500 {
501 alternateRep.setValue(NULL);
502}

◆ computeBBox()

void SoLAr::computeBBox ( SoAction * action,
SbBox3f & box,
SbVec3f & center )
protectedvirtual

compute bounding Box, required

Definition at line 269 of file SoLAr.cxx.

269 {
270 if (fRmax.getNum()< 2) return;
271 if (fRmin.getNum()< 2) return;
272 if (fDz.getNum() < 2) return;
273
274 double MinMin = fRmin[0];
275 double MaxMax = fRmax[0];
276
277 double ZMin = fDz[0];
278 double ZMax = fDz[0];
279
280
281 for (int i=1;i<fRmin.getNum();i++) {
282 if (fRmin[i]<MinMin) MinMin=fRmin[i];
283 }
284
285 for (int i=1;i<fRmax.getNum();i++) {
286 if (fRmax[i]>MaxMax) MaxMax=fRmax[i];
287 }
288
289 for (int i=1;i<fDz.getNum();i++) {
290 if (fDz[i]>ZMax) ZMax=fDz[i];
291 if (fDz[i]<ZMin) ZMin=fDz[i];
292 }
293
294 RevolutionSurfaceUtil::setBBoxPars(fSPhi.getValue(), fDPhi.getValue(),
295 MinMin, MaxMax,
296 ZMin,ZMax,
297 box, center );
298}
static void setBBoxPars(const float &sphi, const float &dphi, const float &rmin, const float &rmax, const float &zmin, const float &zmax, SbBox3f &box, SbVec3f &center)

◆ generateAlternateRep()

void SoLAr::generateAlternateRep ( )
virtual

Generate AlternateRep, required.

Generating an alternate representation must be done upon users request. It allows an Inventor program to read back the file without requiring this code to be dynamically linked. If the users expects that this code will be dynamically linked, he need not invoke this method.

Definition at line 489 of file SoLAr.cxx.

489 {
490
491 // This routine sets the alternate representation to the child
492 // list of this mode.
493
494 if (m_children->getLength() == 0) generateChildren();
496 alternateRep.setValue((SoSeparator *) ( *m_children)[0]);
497}
void updateChildren()
Used to modify hidden children when a data field is changed.
Definition SoLAr.cxx:304
void generateChildren()
Generate Children.
Definition SoLAr.cxx:461

◆ generateChildren()

void SoLAr::generateChildren ( )
private

Generate Children.

Used to create the hidden children. Required whenever the node has hidden children.

Definition at line 461 of file SoLAr.cxx.

461 {
462#ifdef IMPLEMENTED
463 // (Not implemented so you do not get an alternate rep. Too bad.)
464
465
466 // This routines creates one SoSeparator, one SoCoordinate3, and
467 // one SoLineSet, and puts it in the child list. This is done only
468 // once, whereas redrawing the position of the coordinates occurs each
469 // time an update is necessary, in the updateChildren routine.
470
471 assert(m_children->getLength() ==0);
472 SoSeparator *sep = new SoSeparator();
473 SoCoordinate3 *theCoordinates = new SoCoordinate3();
474 SoNormal *theNormals = new SoNormal();
475 SoNormalBinding *theNormalBinding = new SoNormalBinding();
476 SoIndexedFaceSet *theFaceSet = new SoIndexedFaceSet();
477 //
478 // This line costs some in render quality! but gives speed.
479 //
480 sep->addChild(theCoordinates);
481 sep->addChild(theNormals);
482 sep->addChild(theNormalBinding);
483 sep->addChild(theFaceSet);
484 m_children->append(sep);
485#endif
486}

◆ generatePrimitives()

void SoLAr::generatePrimitives ( SoAction * action)
protectedvirtual

Generate Primitives, required.

Definition at line 72 of file SoLAr.cxx.

72 {
73 // This variable is used to store each vertex
74 SoPrimitiveVertex pv;
75
76 // Access the stat from the action
77 SoState *state = action->getState();
78 if (!state)
79 return;
80
81 // See if we have to use a texture coordinate function,
82 // rather than generating explicit texture coordinates.
83 SbBool useTexFunction=
84 (SoTextureCoordinateElement::getType(state) ==
85 SoTextureCoordinateElement::FUNCTION);
86
87 // If we need to generate texture coordinates with a function,
88 // we'll need an SoGLTextureCoordinateElement. Otherwise, we'll
89 // set up the coordinates directly.
90 const SoTextureCoordinateElement *tce = NULL;
91 SbVec4f texCoord;
92 if (useTexFunction) {
93 tce = SoTextureCoordinateElement::getInstance(state);
94 } else {
95 texCoord[2] = 0.0;
96 texCoord[3] = 1.0;
97 }
98 SbVec3f point, normal;
99
101 //-----------------------------------------------------
102#define GEN_VERTEX(pv,x,y,z,s,t,nx,ny,nz) \
103 point.setValue((float)(x),(float)(y),(float)(z)); \
104 normal.setValue((float)(nx),(float)(ny),(float)(nz)); \
105 if (useTexFunction) { \
106 texCoord=tce->get(point,normal); \
107 } else { \
108 texCoord[0]=(float)(s); \
109 texCoord[1]=(float)(t); \
110 } \
111 pv.setPoint(point); \
112 pv.setNormal(normal); \
113 pv.setTextureCoords(texCoord); \
114 shapeVertex(&pv);
115 //-----------------------------------------------------
117
118 if (fRmin.getNum()!=fRmax.getNum() || fRmax.getNum() != fDz.getNum()) {
119 return;
120 }
121
122 int nSeg = fRmin.getNum()-1;
123 if (nSeg<1) {
124 return;
125 }
126
127 for (int p=0;p<nSeg;p++) {
128
129 double rMin1= fRmin[p];
130 double rMin2= fRmin[p+1];
131
132 double rMax1= fRmax[p];
133 double rMax2= fRmax[p+1];
134
135 double zMin = fDz[p];
136 double zMax= fDz[p+1];
137
138 int NPHI = RevolutionSurfaceUtil::nphiDivisions( fDPhi.getValue(), this->getComplexityValue(action), pOverrideNPhi.getValue() );
139
140 double deltaPhi = fDPhi.getValue()/NPHI;
141 double phi0 = fSPhi.getValue();
142 double phi1 = phi0 + fDPhi.getValue();
143 double cosPhi0 = cos(phi0);
144 double sinPhi0 = sin(phi0);
145 double cosPhi1 = cos(phi1);
146 double sinPhi1 = sin(phi1);
147 double cosDeltaPhi = cos(deltaPhi);
148 double sinDeltaPhi = sin(deltaPhi);
149
150 int i;
151 double sinPhi;
152 double cosPhi;
153
154 //
155 // The outer surface!
156 //
157 if (1)
158 {
159 double dR =rMax2-rMax1;
160 double dZ =zMax-zMin;
161 double cosTheta = -dR/sqrt(dR*dR+dZ*dZ);
162 double sinTheta = dZ/sqrt(dR*dR+dZ*dZ);
163
164 beginShape(action,TRIANGLE_STRIP);
165 sinPhi=sinPhi0;
166 cosPhi=cosPhi0;
167 for (i = 0; i<=NPHI; i++) {
168 GEN_VERTEX(pv,rMax2*cosPhi,rMax2*sinPhi,zMax,0.0,0.0,sinTheta*cosPhi,sinTheta*sinPhi,cosTheta);
169 GEN_VERTEX(pv,rMax1*cosPhi,rMax1*sinPhi,zMin,1.0,1.0,sinTheta*cosPhi,sinTheta*sinPhi,cosTheta);
170 inc(sinPhi, cosPhi, sinDeltaPhi, cosDeltaPhi);
171 }
172 endShape();
173 }
174 if (1)
175 //
176 // The inner surface!
177 //
178 {
179 beginShape(action,TRIANGLE_STRIP);
180 sinPhi=sinPhi0;
181 cosPhi=cosPhi0;
182
183 double dR =rMin2-rMin1;
184 double dZ =zMax-zMin;
185 double cosTheta = -dR/sqrt(dR*dR+dZ*dZ);
186 double sinTheta = dZ/sqrt(dR*dR+dZ*dZ);
187
188 for (i = 0; i<=NPHI; i++) {
189 GEN_VERTEX(pv,rMin2*cosPhi,rMin2*sinPhi,zMax,0.0,0.0,-cosPhi*sinTheta,-sinPhi*sinTheta,-cosTheta);
190 GEN_VERTEX(pv,rMin1*cosPhi,rMin1*sinPhi,zMin,1.0,1.0,-cosPhi*sinTheta,-sinPhi*sinTheta,-cosTheta);
191 inc(sinPhi, cosPhi, sinDeltaPhi, cosDeltaPhi);
192 }
193
194 endShape();
195 }
196
197 if (1) {
198 if (fabs(deltaPhi)<2.0*M_PI) {
199 //
200 // The end
201 //
202 beginShape(action,TRIANGLE_STRIP);
203 sinPhi=sinPhi0;
204 cosPhi=cosPhi0;
205 GEN_VERTEX(pv,rMax2*cosPhi,rMax2*sinPhi,zMax,0.0,0.0,sinPhi,-cosPhi,0);
206 GEN_VERTEX(pv,rMax1*cosPhi,rMax1*sinPhi,zMin,1.0,1.0,sinPhi,-cosPhi,0);
207 GEN_VERTEX(pv,rMin2*cosPhi,rMin2*sinPhi,zMax,1.0,0.0,sinPhi,-cosPhi,0);
208 GEN_VERTEX(pv,rMin1*cosPhi,rMin1*sinPhi,zMin,0.0,1.0,sinPhi,-cosPhi,0);
209 endShape();
210 //
211 // The other end
212 //
213 beginShape(action,TRIANGLE_STRIP);
214 sinPhi=sinPhi1;
215 cosPhi=cosPhi1;
216 GEN_VERTEX(pv,rMax2*cosPhi,rMax2*sinPhi, zMax,0.0,0.0,-sinPhi,+cosPhi,0);
217 GEN_VERTEX(pv,rMax1*cosPhi,rMax1*sinPhi, zMin,1.0,1.0,-sinPhi,+cosPhi,0);
218 GEN_VERTEX(pv,rMin2*cosPhi,rMin2*sinPhi, zMax,1.0,0.0,-sinPhi,+cosPhi,0);
219 GEN_VERTEX(pv,rMin1*cosPhi,rMin1*sinPhi, zMin,0.0,1.0,-sinPhi,+cosPhi,0);
220 endShape();
221 }
222 }
223 if (p==(nSeg-1)) {
224 //
225 // The outer surface at z=+PDZ
226 //
227 beginShape(action,TRIANGLE_STRIP);
228 sinPhi=sinPhi0;
229 cosPhi=cosPhi0;
230 for (i = 0; i<=NPHI; i++) {
231 GEN_VERTEX(pv,rMin2*cosPhi,rMin2*sinPhi,zMax,0.0,0.0,0,0,1);
232 GEN_VERTEX(pv,rMax2*cosPhi,rMax2*sinPhi,zMax,1.0,1.0,0,0,1);
233 inc(sinPhi, cosPhi, sinDeltaPhi, cosDeltaPhi);
234 }
235 endShape();
236 }
237 if (p==0) {
238 //
239 // The outer surface at z=-PDZ
240 //
241 beginShape(action,TRIANGLE_STRIP);
242 sinPhi=sinPhi0;
243 cosPhi=cosPhi0;
244 for (i = 0; i<=NPHI; i++) {
245 GEN_VERTEX(pv,rMin1*cosPhi,rMin1*sinPhi,zMin,0.0,0.0,0,0,-1);
246 GEN_VERTEX(pv,rMax1*cosPhi,rMax1*sinPhi,zMin,1.0,1.0,0,0,-1);
247 inc(sinPhi, cosPhi, sinDeltaPhi, cosDeltaPhi);
248 }
249 endShape();
250 }
251 }
252
253 if (state&&state->isElementEnabled(SoGLCacheContextElement::getClassStackIndex())) {
254 //Encourage auto caching
255 SoGLCacheContextElement::shouldAutoCache(state, SoGLCacheContextElement::DO_AUTO_CACHE);
256#if ((COIN_MAJOR_VERSION>=3)||((COIN_MAJOR_VERSION==2)&&(COIN_MINOR_VERSION>=5)))
257 SoGLCacheContextElement::incNumShapes(state);
258#endif
259 }
260}
Scalar deltaPhi(const MatrixBase< Derived > &vec) const
#define GEN_VERTEX(pv, x, y, z, s, t, nx, ny, nz)
static int nphiDivisions(const float &dphi, const float &complexity, int OverrideNPhi=0)
void inc(double &sinPhi, double &cosPhi, double sinDeltaPhi, double cosDeltaPhi) const
help with trigonometry. increments sines an cosines by an angle.
Definition SoLAr.h:143

◆ getChildren()

SoChildList * SoLAr::getChildren ( ) const
protectedvirtual

GetChildList, required whenever the class has hidden children.

Definition at line 263 of file SoLAr.cxx.

263 {
264 return m_children.get();
265}

◆ inc()

void SoLAr::inc ( double & sinPhi,
double & cosPhi,
double sinDeltaPhi,
double cosDeltaPhi ) const
inlineprivate

help with trigonometry. increments sines an cosines by an angle.

Definition at line 143 of file SoLAr.h.

143 {
144 double oldSin=sinPhi,oldCos=cosPhi;
145 sinPhi = oldSin*cosDeltaPhi+oldCos*sinDeltaPhi;
146 cosPhi = oldCos*cosDeltaPhi-oldSin*sinDeltaPhi;
147 }

◆ initClass()

void SoLAr::initClass ( )
static

Class Initializer, required.

Definition at line 62 of file SoLAr.cxx.

63{
64 [[maybe_unused]] static const bool didInit = [&]() {
65 SO_NODE_INIT_CLASS(SoLAr,SoShape,"Shape");
66 return true;
67 }();
68}

◆ SO_NODE_HEADER()

SoLAr::SO_NODE_HEADER ( SoLAr )
private

◆ updateChildren()

void SoLAr::updateChildren ( )
private

Used to modify hidden children when a data field is changed.

Required whenever the class has hidden children.

Definition at line 304 of file SoLAr.cxx.

304 {
305
306#ifdef IMPLEMENTED
307
308 // (Not implemented so you do not get an alternate rep. Too bad.)
309
310 // Redraw the G4LAr....
311
312 assert(m_children->getLength()==1);
313 SoSeparator *sep = (SoSeparator *) ( *m_children)[0];
314 SoCoordinate3 *theCoordinates = (SoCoordinate3 *) ( sep->getChild(0));
315 SoNormal *theNormals = (SoNormal *) ( sep->getChild(1));
316 SoNormalBinding *theNormalBinding = (SoNormalBinding *) ( sep->getChild(2));
317 SoIndexedFaceSet *theFaceSet = (SoIndexedFaceSet *) ( sep->getChild(3));
318
319 const int NPHI=96, NPOINTS=2*(2*NPHI+2), NFACES=4*NPHI+2, NINDICES = NFACES*5;
320 float points[NPOINTS][3], normals[NFACES][3];
321#ifdef INVENTOR2_0
322 static long indices[NINDICES];
323#else
324 static int32_t indices[NINDICES];
325#endif
326 static int init=0;
327 double phi, pp, DeltaPhi;
328
329 // Indices need to be generated once! This is here to keep it close to the point
330 // generation, since otherwise it will be confusing.
331
332 int i;
333 if (!init) {
334 init = 1;
335 // Outer face
336 for (i = 0; i< NPHI; i++) {
337 // 0 1 3 2;
338 indices[5*i+0] = 2*i+0;
339 indices[5*i+1] = 2*i+1;
340 indices[5*i+2] = 2*i+3;
341 indices[5*i+3] = 2*i+2;
342 indices[5*i+4] = SO_END_FACE_INDEX;
343 }
344 // the inner face
345 for (i=0;i<NPHI;i++) {
346 indices[5*1*NPHI + 5*i+0] = 2*NPHI+2 + 2*i+0;
347 indices[5*1*NPHI + 5*i+1] = 2*NPHI+2 + 2*i+1;
348 indices[5*1*NPHI + 5*i+2] = 2*NPHI+2 + 2*i+3;
349 indices[5*1*NPHI + 5*i+3] = 2*NPHI+2 + 2*i+2;
350 indices[5*1*NPHI + 5*i+4] = SO_END_FACE_INDEX;
351 }
352 // the top side
353 for (i=0;i<NPHI;i++) {
354 indices[5*2*NPHI + 5*i+0] = 2*i+0;
355 indices[5*2*NPHI + 5*i+1] = 2*i+2;
356 indices[5*2*NPHI + 5*i+2] = NPOINTS - (2*i+4);
357 indices[5*2*NPHI + 5*i+3] = NPOINTS - (2*i+2);
358 indices[5*2*NPHI + 5*i+4] = SO_END_FACE_INDEX;
359 }
360 // the bottom side
361 for (i=0;i<NPHI;i++) {
362 indices[5*3*NPHI + 5*i+0] = 2*i+1;
363 indices[5*3*NPHI + 5*i+1] = NPOINTS - (2*i+1);
364 indices[5*3*NPHI + 5*i+2] = NPOINTS - (2*i+3);
365 indices[5*3*NPHI + 5*i+3] = 2*i+3;
366 indices[5*3*NPHI + 5*i+4] = SO_END_FACE_INDEX;
367 }
368 // the odd side
369 indices[5*4*NPHI +0] = 2*NPHI;
370 indices[5*4*NPHI +1] = 2*NPHI+1;
371 indices[5*4*NPHI +2] = 2*NPHI+3;
372 indices[5*4*NPHI +3] = 2*NPHI+2;
373 indices[5*4*NPHI +4] = SO_END_FACE_INDEX;
374 // aother odd side
375 indices[5*4*NPHI +5 +0] = 0;
376 indices[5*4*NPHI +5 +1] = NPOINTS-2;
377 indices[5*4*NPHI +5 +2] = NPOINTS-1;
378 indices[5*4*NPHI +5 +3] = 1;
379 indices[5*4*NPHI +5 +4] = SO_END_FACE_INDEX;
380 }
381 // Points need to be generated each time:
382 // The outer surface
383 DeltaPhi = fDPhi.getValue()/NPHI, phi = fSPhi.getValue();
384 float t,st,ct;
385 t = FATAN((fRmax2.getValue()-fRmax1.getValue())/(2*fDz.getValue()));
386 st = FSIN(t);
387 ct = FCOS(t);
388 for (i = 0; i<=NPHI; i++) {
389 points[2*i+0][0] = fRmax2.getValue()*FCOS(phi);
390 points[2*i+0][1] = fRmax2.getValue()*FSIN(phi);
391 points[2*i+0][2] = +fDz.getValue();
392 points[2*i+1][0] = fRmax1.getValue()*FCOS(phi);
393 points[2*i+1][1] = fRmax1.getValue()*FSIN(phi);
394 points[2*i+1][2] = -fDz.getValue();
395 pp = phi+DeltaPhi/2.0;
396 if (i!=NPHI) {
397 normals[i][0] = ct * FCOS(pp);
398 normals[i][1] = ct * FSIN(pp);
399 normals[i][2] = -st;
400 }
401 phi+=DeltaPhi;
402 }
403 // The inner surface
404 phi = fSPhi.getValue() + fDPhi.getValue();
405 t = FATAN((fRmin2.getValue()-fRmin1.getValue())/(2*fDz.getValue()));
406 st = FSIN(t);
407 ct = FCOS(t);
408 for (i = 0; i<=NPHI; i++) {
409 points[2*NPHI+2+2*i+0][0] = fRmin2.getValue()*FCOS(phi);
410 points[2*NPHI+2+2*i+0][1] = fRmin2.getValue()*FSIN(phi);
411 points[2*NPHI+2+2*i+0][2] = +fDz.getValue();
412 points[2*NPHI+2+2*i+1][0] = fRmin1.getValue()*FCOS(phi);
413 points[2*NPHI+2+2*i+1][1] = fRmin1.getValue()*FSIN(phi);
414 points[2*NPHI+2+2*i+1][2] = -fDz.getValue();
415 pp = phi-DeltaPhi/2.0;
416 if (i!=NPHI) {
417 normals[NPHI+i][0] = -ct*FCOS(pp);
418 normals[NPHI+i][1] = -ct*FSIN(pp);
419 normals[NPHI+i][2] = st;
420 }
421 phi-=DeltaPhi;
422 }
423 // The top side
424 for (i=0;i<NPHI;i++) {
425 normals[2*NPHI+i][0]=normals[2*NPHI+i][1]=0;
426 normals[2*NPHI+i][2]= 1.0;
427 }
428 // The bottom side
429 for (i=0;i<NPHI;i++) {
430 normals[3*NPHI+i][0]=normals[3*NPHI+i][1]=0;
431 normals[3*NPHI+i][2]= -1.0;
432 }
433 // The odd side
434 phi = fSPhi.getValue();
435 normals[4*NPHI+0][0]= FSIN(phi);
436 normals[4*NPHI+0][1]= -FCOS(phi);
437 normals[4*NPHI+0][2]= 0;
438
439 // Another odd side
440 phi = fSPhi.getValue()+fDPhi.getValue();
441 normals[4*NPHI+1][0]= -FSIN(phi);
442 normals[4*NPHI+1][1]= +FCOS(phi);
443 normals[4*NPHI+1][2]=0;
444
445 for (int np=0;np<NPOINTS;np++) theCoordinates->point.set1Value(np,points[np][0],points[np][1],points[np][2]);
446 theFaceSet->coordIndex.setValues(0,NINDICES,indices);
447 if (smoothDraw.getValue()) {
448 // This Line is replaced by the next one because of an apparent Bug in Inventor (mem. leak).
449 // theNormals->vector.deleteValues(0);
450 for (int nf=0;nf<NFACES;nf++) theNormals->vector.set1Value(nf,normals[nf][0],normals[nf][1],normals[nf][2]);
451 theNormalBinding->value=SoNormalBinding::PER_FACE;
452 }
453 else {
454 for (int nf=0;nf<NFACES;nf++) theNormals->vector.set1Value(nf,normals[nf][0],normals[nf][1],normals[nf][2]);
455 theNormalBinding->value=SoNormalBinding::PER_FACE;
456 }
457#endif
458}
Scalar phi() const
phi method
#define FCOS(x)
Definition SbMath.h:13
#define FSIN(x)
Definition SbMath.h:14
#define FATAN(x)
Definition SbMath.h:18
std::pair< long int, long int > indices
init(v_theApp, v_rootStream=None)
Definition PyKernel.py:45

Member Data Documentation

◆ alternateRep

SoSFNode SoLAr::alternateRep

Alternate rep required - for use by users without HEPVis shared objects.

Definition at line 78 of file SoLAr.h.

◆ fDPhi

SoSFFloat SoLAr::fDPhi

Delta-angle, in radians.

Definition at line 65 of file SoLAr.h.

◆ fDz

SoMFFloat SoLAr::fDz

Z Positions.

Definition at line 57 of file SoLAr.h.

◆ fRmax

SoMFFloat SoLAr::fRmax

Outside radii.

Definition at line 53 of file SoLAr.h.

◆ fRmin

SoMFFloat SoLAr::fRmin

Inside radii.

Definition at line 49 of file SoLAr.h.

◆ fSPhi

SoSFFloat SoLAr::fSPhi

Starting angle, in radians.

Definition at line 61 of file SoLAr.h.

◆ m_children

std::unique_ptr<SoChildList> SoLAr::m_children
private

ChildList. Required whenever the class has hidden children.

Definition at line 138 of file SoLAr.h.

◆ pOverrideNPhi

SoSFInt32 SoLAr::pOverrideNPhi

Override number of phi subdivision used for rendering shape (i.e.

ignore e.g. complexity value). Put field to 0 (the default) to ignore it.

Definition at line 74 of file SoLAr.h.

◆ smoothDraw

SoSFBool SoLAr::smoothDraw

An Inventor option - slightly better render, worse performance.

Definition at line 69 of file SoLAr.h.


The documentation for this class was generated from the following files: