ATLAS Offline Software
Loading...
Searching...
No Matches
SoGenericBox.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3*/
4
5
7// //
8// Header file for class SoGenericBox //
9// //
10// Description: Generic way to draw boxes with arbitrary //
11// corners and possibly lines at the edges. //
12// //
13// Author: Thomas H. Kittelmann (Thomas.Kittelmann@cern.ch) //
14// Initial version: December 2008 //
15// //
17
18#ifndef SOGENERICBOX_H
19#define SOGENERICBOX_H
20
21#include <Inventor/C/errors/debugerror.h>
22#include <Inventor/fields/SoSFNode.h>
23#include <Inventor/fields/SoSFBool.h>
24#include <Inventor/nodes/SoShape.h>
25
26class SoGenericBox : public SoShape {
27
29
30public:
31
32 //Fields:
33 SoSFBool drawEdgeLines;//Default: False
34 SoSFBool forceEdgeLinesInBaseColour;//Default: True
35 SoSFNode alternateRep;
36
37 //NB: For performance reason we deviate from the standard Inventor
38 //way here. We keep the points in an array, and the user must use
39 //one of the following setXXX(..) methods to ensure that they get
40 //sensible values (the fDrawEdgeLines field will be touched inside
41 //these methods, to ensure a proper cache-invalidation).
42
43 // -> Axis-aligned box
44 void setParametersForBox( float dx, float dy, float dz,
45 float xcenter = 0.0, float ycenter = 0.0, float zcenter = 0.0 );//NB: These are half-lengths.
46
47 // -> Barrel cell (i.e. fix inner face at cylinder around Z-axis, with r=cellDistance):
48 void setParametersForBarrelEtaPhiCell( double etaMin, double etaMax,
49 double phiMin, double phiMax,
50 double cellDepth, double cellDistance,
51 double etasqueezefact = 1.0,
52 double phisqueezefact = 1.0 );
53
54 // -> EndCap cell (i.e. fix inner face at plane at |Z|=|cellDistance|):
55 void setParametersForEndCapEtaPhiCell( double etaMin, double etaMax,
56 double phiMin, double phiMax,
57 double cellDepth, double cellDistance,
58 double etasqueezefact = 1.0,
59 double phisqueezefact = 1.0 );
60
61 // -> Trd
62 void setParametersForTrd( float dx1, float dx2,
63 float dy1, float dy2,
64 float dz );
65
66 // -> Trapezoid
67 void setParametersForTrapezoid( float dz, float theta, float phi, float dy1,
68 float dx1, float dx2, float dy2, float dx3,
69 float dx4, float alp1, float alp2 );
70
71 // -> Generic [NB: The 4 points around each face should lie in a common plane!!]
72 void setGenericParameters( float x0, float y0, float z0,
73 float x1, float y1, float z1,
74 float x2, float y2, float z2,
75 float x3, float y3, float z3,
76 float x4, float y4, float z4,
77 float x5, float y5, float z5,
78 float x6, float y6, float z6,
79 float x7, float y7, float z7 );
80
81 //Todo: We could even add a transformation for the TRD (or anything
82 //else... perhaps an "applyTransform" method to call after the first
83 //setParameters...?)
84 //(i.e. specify in absolute coordinates, and thus avoid a
85 //transformation in the scenegraph!)
86
87 //Required stuff:
89 static void initClass();//You can call this as many times as you like
90 virtual void generateAlternateRep();
91 virtual void clearAlternateRep();
92
93protected:
94
95 virtual void computeBBox(SoAction *action, SbBox3f &box, SbVec3f &center );
96 virtual void generatePrimitives(SoAction *action);
97 virtual ~SoGenericBox();
98
99private:
100
101 void internalSetParametersForEtaPhiCell( bool barrel, double etaMin, double etaMax,
102 double phiMin, double phiMax,
103 double cellDepth, double cellDistance,
104 double etasqueezefact, double phisqueezefact );
105
107 void pointsUpdated();
108 void setupDefaultPoints();
109
110 float * m_points;
111 float * m_normals;
112 SbBox3f m_bbox;
113 SbVec3f m_center;
114};
115
116#endif
Scalar phi() const
phi method
Scalar theta() const
theta method
SoSFNode alternateRep
virtual void clearAlternateRep()
void setParametersForBox(float dx, float dy, float dz, float xcenter=0.0, float ycenter=0.0, float zcenter=0.0)
SO_NODE_HEADER(SoGenericBox)
void internalSetParametersForEtaPhiCell(bool barrel, double etaMin, double etaMax, double phiMin, double phiMax, double cellDepth, double cellDistance, double etasqueezefact, double phisqueezefact)
void ensurePointsAllocated()
virtual ~SoGenericBox()
void setParametersForTrapezoid(float dz, float theta, float phi, float dy1, float dx1, float dx2, float dy2, float dx3, float dx4, float alp1, float alp2)
float * m_points
void setParametersForTrd(float dx1, float dx2, float dy1, float dy2, float dz)
void setGenericParameters(float x0, float y0, float z0, float x1, float y1, float z1, float x2, float y2, float z2, float x3, float y3, float z3, float x4, float y4, float z4, float x5, float y5, float z5, float x6, float y6, float z6, float x7, float y7, float z7)
SoSFBool forceEdgeLinesInBaseColour
virtual void computeBBox(SoAction *action, SbBox3f &box, SbVec3f &center)
void setParametersForBarrelEtaPhiCell(double etaMin, double etaMax, double phiMin, double phiMax, double cellDepth, double cellDistance, double etasqueezefact=1.0, double phisqueezefact=1.0)
static void initClass()
void setupDefaultPoints()
float * m_normals
virtual void generatePrimitives(SoAction *action)
SoSFBool drawEdgeLines
SbVec3f m_center
void setParametersForEndCapEtaPhiCell(double etaMin, double etaMax, double phiMin, double phiMax, double cellDepth, double cellDistance, double etasqueezefact=1.0, double phisqueezefact=1.0)
virtual void generateAlternateRep()