source: trunk/source/visualization/OpenInventor/include/HEPVis/nodes/SoTubs.h @ 1347

Last change on this file since 1347 was 1347, checked in by garnier, 13 years ago

geant4 tag 9.4

  • Property svn:mime-type set to text/cpp
File size: 5.6 KB
Line 
1//
2// ********************************************************************
3// * License and Disclaimer                                           *
4// *                                                                  *
5// * The  Geant4 software  is  copyright of the Copyright Holders  of *
6// * the Geant4 Collaboration.  It is provided  under  the terms  and *
7// * conditions of the Geant4 Software License,  included in the file *
8// * LICENSE and available at  http://cern.ch/geant4/license .  These *
9// * include a list of copyright holders.                             *
10// *                                                                  *
11// * Neither the authors of this software system, nor their employing *
12// * institutes,nor the agencies providing financial support for this *
13// * work  make  any representation or  warranty, express or implied, *
14// * regarding  this  software system or assume any liability for its *
15// * use.  Please see the license in the file  LICENSE  and URL above *
16// * for the full disclaimer and the limitation of liability.         *
17// *                                                                  *
18// * This  code  implementation is the result of  the  scientific and *
19// * technical work of the GEANT4 collaboration.                      *
20// * By using,  copying,  modifying or  distributing the software (or *
21// * any work based  on the software)  you  agree  to acknowledge its *
22// * use  in  resulting  scientific  publications,  and indicate your *
23// * acceptance of all terms of the Geant4 Software license.          *
24// ********************************************************************
25//
26//
27// $Id: SoTubs.h,v 1.3 2006/06/29 21:22:10 gunter Exp $
28// GEANT4 tag $Name: geant4-09-04-ref-00 $
29//
30/*-----------------------------Hepvis----------------------------------------*/
31/*                                                                           */
32/* Node:             SoTubs                                                  */
33/* Description:      Represents the G4Tubs Geant Geometry entity             */
34/* Author:           Joe Boudreau Nov 11 1996                                */
35/*                                                                           */
36/*---------------------------------------------------------------------------*/
37#ifndef HEPVis_SoTubs_h
38#define HEPVis_SoTubs_h
39
40#include <Inventor/fields/SoSFFloat.h>
41#include <Inventor/fields/SoSFNode.h>
42#include <Inventor/fields/SoSFBool.h>
43#include <Inventor/nodes/SoShape.h>
44
45class SoSFNode;
46
47//! SoTubs - Inventor version of the G4Tubs Geant Geometry entity
48/*!
49 * Node:             SoTubs
50 *
51 * Description:      The Inventor version of the G4Tubs Geant Geometry entity
52 *
53 * Author:           Joe Boudreau Nov 11 1996
54 *
55 * class G4Tubs
56 *
57 * A tube or tube segment with curved sides parallel to
58 * the z-axis. The tube has a specified half-length along
59 * the z axis, about which it is centred, and a given
60 * minimum and maximum radius. A minimum radius of 0
61 * signifies a filled tube /cylinder. The tube segment is
62 * specified by starting and delta
63 * angles for phi, with 0 being the +x axis, PI/2
64 * the +y axis. A delta angle of 2PI signifies a
65 * complete, unsegmented tube/cylinder
66 *
67 * Always use Inventor Fields. This allows Inventor to detect a change to
68 * the data field and take the appropriate action; e.g., redraw the scene.
69*/
70
71#define SoTubs Geant4_SoTubs
72
73class SoTubs:public SoShape {
74
75  // The following is required:
76  SO_NODE_HEADER(SoTubs);
77 
78public:
79
80  //
81  //! Inside radius of the tube
82  //
83  SoSFFloat pRMin;   
84  //
85  //! Outside radius of the tube
86  //
87  SoSFFloat pRMax;
88  //
89  //! Half-length in Z
90  //
91  SoSFFloat pDz;
92  //
93  //! Starting angle, in radians
94  //
95  SoSFFloat pSPhi;
96  //
97  //! Delta-angle, in radians
98  //
99  SoSFFloat pDPhi;             
100  //
101  //! Alternate rep - required
102  //
103  SoSFNode  alternateRep;
104
105  //
106  //! Constructor, required
107  //
108  SoTubs();
109
110  //
111  //! Class Initializer, required
112  //
113  static void initClass();
114
115  //
116  //! Generate AlternateRep, required.  Generating an alternate representation
117  //! must be done upon users request.  It allows an Inventor program to read
118  //! back the file without requiring *this* code to be dynamically linked.
119  //! If the users expects that *this* code will be dynamically linked, he
120  //! need not invoke this method. 
121  //
122  virtual void generateAlternateRep();
123
124  //
125  //! We better be able to clear it, too!
126  //
127  virtual void clearAlternateRep();
128
129protected:
130
131  //
132  //! compute bounding Box, required
133  //
134  virtual void computeBBox(SoAction *action, SbBox3f &box, SbVec3f &center );
135
136  //
137  //! Generate Primitives, required
138  //
139  virtual void generatePrimitives(SoAction *action);
140
141  //
142  //! GetChildList, required whenever the class has hidden children
143  //
144  virtual SoChildList *getChildren() const;
145
146
147protected:
148  //
149  //! Destructor, required
150  //
151  virtual ~SoTubs();
152
153private:
154
155  //
156  //! Generate Children. Used to create the hidden children. Required whenever
157  //! the node has hidden children. 
158  //
159  void generateChildren(); 
160
161  //
162  //! Used to modify hidden children when a data field is changed. Required
163  //! whenever the class has hidden children.
164  //
165  void updateChildren();
166
167  //
168  //! ChildList. Required whenever the class has hidden children. 
169  //
170  SoChildList *children;
171
172  //
173  //! help with trigonometry.  increments sines an cosines by an angle.
174  //
175  void inc(double & sinPhi, double & cosPhi, double sinDeltaPhi, double cosDeltaPhi) const {
176    double oldSin=sinPhi,oldCos=cosPhi;
177    sinPhi = oldSin*cosDeltaPhi+oldCos*sinDeltaPhi;
178    cosPhi = oldCos*cosDeltaPhi-oldSin*sinDeltaPhi;   
179  }
180
181};
182
183#endif
Note: See TracBrowser for help on using the repository browser.