Import Geant4 6.2.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-09 10:56:29 +02:00
parent 1d812b78b1
commit e083ffb441
1415 changed files with 111223 additions and 21207 deletions
@@ -0,0 +1,53 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
//
// $Id: SbMath.h,v 1.2 2004/06/14 09:27:34 gcosmo Exp $
// GEANT4 tag $Name: geant4-06-02 $
//
#ifndef HEPVis_SbMath_h
#define HEPVis_SbMath_h
#include <math.h>
#ifndef M_PI
#define M_PI 3.1415926535897931160E0
#define M_PI_2 1.5707963267948965580E0
#endif
#define SbMinimum(a,b) ((a)<(b)?a:b)
#define SbMaximum(a,b) ((a)>(b)?a:b)
#define FCOS(x) ((float)cos((double)(x)))
#define FSIN(x) ((float)sin((double)(x)))
#define FACOS(x) ((float)acos((double)(x)))
#define FASIN(x) ((float)asin((double)(x)))
#define FTAN(x) ((float)tan((double)(x)))
#define FATAN(x) ((float)atan((double)(x)))
#define FSQRT(x) ((float)sqrt((double)(x)))
#define FPOW(x,y) ((float)pow((double)(x),(double)(y)))
#define FLOG(x) ((float)log((double)(x)))
#define FLOG10(x) ((float)log10((double)(x)))
#define FFLOOR(x) ((float)floor((double)(x)))
#define FFABS(x) ((float)fabs((double)(x)))
#define FCEIL(x) ((float)ceil((double)(x)))
#endif
@@ -0,0 +1,115 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
//
// $Id: SoDetectorTreeKit.h,v 1.2 2004/06/14 09:27:35 gcosmo Exp $
// GEANT4 tag $Name: geant4-06-02 $
//
/*-----------------------------Hepvis----------------------------------------*/
/* */
/* Node: SoDetectorTreeKit */
/* Description: Easy way of browsing through a tree of detectors */
/* Author: Joe Boudreau Nov 11 1996 */
/* */
/*---------------------------------------------------------------------------*/
#ifndef HEPVis_SoDetectorTreeKit_h
#define HEPVis_SoDetectorTreeKit_h
#include <Inventor/nodekits/SoBaseKit.h>
#include <Inventor/nodes/SoEventCallback.h>
class SoSFNode;
class SoHandleEventAction;
class SoSeparator;
#define SoDetectorTreeKit Geant4_SoDetectorTreeKit
class SoDetectorTreeKit:public SoBaseKit {
// The following is required:
SO_KIT_HEADER(SoDetectorTreeKit);
////////////////////////////////////////////
SoSFNode alternateRep;
////////////////////////////////////////////
SO_KIT_CATALOG_ENTRY_HEADER(callbackList);
SO_KIT_CATALOG_ENTRY_HEADER(topSeparator);
SO_KIT_CATALOG_ENTRY_HEADER(pickStyle);
SO_KIT_CATALOG_ENTRY_HEADER(appearance);
SO_KIT_CATALOG_ENTRY_HEADER(units);
SO_KIT_CATALOG_ENTRY_HEADER(transform);
SO_KIT_CATALOG_ENTRY_HEADER(texture2Transform);
SO_KIT_CATALOG_ENTRY_HEADER(childList);
SO_KIT_CATALOG_ENTRY_HEADER(previewSeparator);
SO_KIT_CATALOG_ENTRY_HEADER(fullSeparator);
public:
// Constructor, required
SoDetectorTreeKit();
// This is required
virtual SbBool affectsState() const;
// Class Initializer, required
static void initClass();
// Turn the preview on or off
virtual void setPreview(SbBool Flag);
// Return the preview state
virtual SbBool getPreview() const;
// Return the preview Separator
virtual SoSeparator *getPreviewSeparator() const;
// Return the full Separator
virtual SoSeparator *getFullSeparator() const;
// 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.
virtual void generateAlternateRep();
// We better be able to clear it, too!
virtual void clearAlternateRep();
protected:
// Destructor.
virtual ~SoDetectorTreeKit();
private:
// This is needed as well
void createInitialTree();
// This is the callback function that will be
// added to the callback list
static void expand (void *userData, SoEventCallback *eventCB);
static void contract (void *userData, SoEventCallback *eventCB);
};
#endif
@@ -0,0 +1,155 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
//
// $Id: SoBox.h,v 1.2 2004/06/14 09:27:36 gcosmo Exp $
// GEANT4 tag $Name: geant4-06-02 $
//
/*-----------------------------Hepvis----------------------------------------*/
/* */
/* Node: SoBox */
/* Description: Represents the G4Box Geant Geometry entity */
/* Author: Joe Boudreau Nov 11 1996 */
/* */
/*---------------------------------------------------------------------------*/
#ifndef HEPVis_SoBox_h
#define HEPVis_SoBox_h
#include <Inventor/fields/SoSFFloat.h>
#include <Inventor/fields/SoSFNode.h>
#include <Inventor/nodes/SoShape.h>
class SoSFNode;
//! SoBox - Inventor version of the G4Box Geant Geometry entity
/*!
* Node: SoBox
*
* Description: The Inventor version of the G4Box Geant Geometry entity
*
* Author: Joe Boudreau Nov 11 1996
*
* class G4Box
*
* A Box is a cuboid of given half lengths dx,dy,dz. The Box is
* centred on the origin with sides parallel to the x/y/z axes.
*
* Always use Inventor Fields. This allows Inventor to detect a change to
* the data field and take the appropriate action; e.g., redraw the scene.
*/
#define SoBox Geant4_SoBox
class SoBox:public SoShape {
// The following is required:
SO_NODE_HEADER(SoBox);
public:
//
//! Half-length along X
//
SoSFFloat fDx;
//
//! Half-length along Y
//
SoSFFloat fDy;
//
//! Half-length along Z
//
SoSFFloat fDz;
//
//! Alternate rep - for use by users without HEPVis shared objects
//
SoSFNode alternateRep;
//
//! Constructor, required
//
SoBox();
//
//! Class Initializer, required
//
static void initClass();
//
//! 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.
//
virtual void generateAlternateRep();
//
//! We better be able to clear it, too!
//
virtual void clearAlternateRep();
protected:
//
//! compute bounding Box, required
//
virtual void computeBBox(SoAction *action, SbBox3f &box, SbVec3f &center );
//
//! Generate Primitives, required
//
virtual void generatePrimitives(SoAction *action);
//
//! GetChildList, required whenever the class has hidden children
//
virtual SoChildList *getChildren() const;
protected:
//
//! Destructor, required
//
virtual ~SoBox();
private:
//
//! Generate Children. Used to create the hidden children. Required whenever
//! the node has hidden children.
//
void generateChildren();
//
//! Used to modify hidden children when a data field is changed. Required
//! whenever the class has hidden children.
//
void updateChildren();
//
//! ChildList. Required whenever the class has hidden children.
//
SoChildList *children;
};
#endif
@@ -0,0 +1,191 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
//
// $Id: SoCons.h,v 1.2 2004/06/14 09:27:36 gcosmo Exp $
// GEANT4 tag $Name: geant4-06-02 $
//
/*-----------------------------Hepvis----------------------------------------*/
/* */
/* Node: SoCons */
/* Description: Represents the G4Cons Geant Geometry entity */
/* Author: Joe Boudreau Nov 11 1996 */
/* */
/*---------------------------------------------------------------------------*/
#ifndef HEPVis_SoCons_h
#define HEPVis_SoCons_h
#include <Inventor/fields/SoSFFloat.h>
#include <Inventor/fields/SoSFNode.h>
#include <Inventor/fields/SoSFBool.h>
#include <Inventor/nodes/SoShape.h>
class SoSFNode;
//! SoCons - Inventor version of the G4Cons Geant Geometry entity
/*!
* Node: SoCons
*
* Description: The Inventor version of the G4Cons Geant Geometry entity
*
* Author: Joe Boudreau Nov 11 1996
*
* A G4Cons is, in the general case, a Phi segment of a cone, with half-length
* fDz, inner and outer radii specified at -fDz and +fDz. The Phi segment is
* described by a starting fSPhi angle, and the +fDPhi delta angle for the shape.
* If the delta angle is >=2*M_PI, the shape is treated as continuous in Phi
*
* Member Data:
*
* fRmin1 inside radius at -fDz
* fRmin2 inside radius at +fDz
* fRmax1 outside radius at -fDz
* fRmax2 outside radius at +fDz
* fDz half length in z
*
* fSPhi starting angle of the segment in radians
* fDPhi delta angle of the segment in radians
*/
#define SoCons Geant4_SoCons
class SoCons:public SoShape {
// The following is required:
SO_NODE_HEADER(SoCons);
public:
//
//! Inside radius at -fDz
//
SoSFFloat fRmin1;
//
//! Inside radius at +fDz
//
SoSFFloat fRmin2;
//
//! Outside radius at -fDz
//
SoSFFloat fRmax1;
//
//! Outside radius at +fDz
//
SoSFFloat fRmax2;
//
//! Half-length along Z
//
SoSFFloat fDz;
//
//! Starting angle, in radians
//
SoSFFloat fSPhi;
//
//! Delta-angle, in radians
//
SoSFFloat fDPhi;
//
//! An Inventor option - slightly better render, worse performance
//
SoSFBool smoothDraw;
//
//! Alternate rep required - for use by users without HEPVis shared objects
//
SoSFNode alternateRep;
//
//! Constructor, required
//
SoCons();
//
//! Class Initializer, required
//
static void initClass();
//
//! 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.
//
virtual void generateAlternateRep();
//
//! We better be able to clear it, too!
//
virtual void clearAlternateRep();
protected:
//
//! compute bounding Box, required
//
virtual void computeBBox(SoAction *action, SbBox3f &box, SbVec3f &center );
//
//! Generate Primitives, required
//
virtual void generatePrimitives(SoAction *action);
//
//! GetChildList, required whenever the class has hidden children
//
virtual SoChildList *getChildren() const;
protected:
//
//! Destructor, required
//
virtual ~SoCons();
private:
//
//! Generate Children. Used to create the hidden children. Required whenever
//! the node has hidden children.
//
void generateChildren();
//
//! Used to modify hidden children when a data field is changed. Required
//! whenever the class has hidden children.
//
void updateChildren();
//
//! ChildList. Required whenever the class has hidden children.
//
SoChildList *children;
//
//! help with trigonometry. increments sines an cosines by an angle.
//
void inc(double & sinPhi, double & cosPhi, double sinDeltaPhi, double cosDeltaPhi) const {
double oldSin=sinPhi,oldCos=cosPhi;
sinPhi = oldSin*cosDeltaPhi+oldCos*sinDeltaPhi;
cosPhi = oldCos*cosDeltaPhi-oldSin*sinDeltaPhi;
}
};
#endif
@@ -0,0 +1,213 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
//
// $Id: SoTrap.h,v 1.2 2004/06/14 09:27:37 gcosmo Exp $
// GEANT4 tag $Name: geant4-06-02 $
//
/*-----------------------------Hepvis----------------------------------------*/
/* */
/* Node: SoTrap */
/* Description: Represents the G4Trap Geant Geometry entity */
/* Author: Joe Boudreau Nov 11 1996 */
/* */
/*---------------------------------------------------------------------------*/
#ifndef HEPVis_SoTrap_h
#define HEPVis_SoTrap_h
#include <Inventor/fields/SoSFNode.h>
#include <Inventor/fields/SoSFBool.h>
#include <Inventor/nodes/SoShape.h>
//adding fields
#ifdef WIN32
#include <SoWinEnterScope.h>
#endif
// Defining Class
#ifdef WIN32
#include <SoWinLeaveScope.h>
#endif
class SoSFNode;
//! SoTrap - Inventor version of the G4Trap Geant Geometry entity
/*! Node: SoTrap
*
* Description: Inventor version of the G4Trap Geant Geometry entity
*
* Author: Joe Boudreau Nov 11 1996
*
* A G4Trap is a general trapezoid: The faces perpendicular to the z planes
* are tapezia, and their centres are not necessarily on a line parallel to
* the z axis.
*
* Note that of the 11 parameters desribed below, only 9 are really
* independent - a check for planarity is made in the calculation of the
* equation for each plane. If the planes are not parallel, a call to
* G4Exception is made.
*
* Always use Inventor Fields. This allows Inventor to detect a change to
* the data field and take the appropriate action; e.g., redraw the scene.
*
*/
#define SoTrap Geant4_SoTrap
class SoTrap:public SoShape {
// The following is required:
SO_NODE_HEADER(SoTrap);
public:
#if defined(WIN32) && defined(BUILDING_DLL)
// When building the node as a DLL under Win32 we must explicitly
// declare this entry point as visible outside the DLL. The macro
// BUILDING_DLL is defined in the node's source file.
_declspec(dllexport)
#endif
//
//! half-length along Z
//
SoSFFloat pDz;
//
//! Polar angle of the line joining the centres of the faces at -/+pDz
//
SoSFFloat pTheta;
//
//! Azimuthal angle of the line joing the centre of the face at -pDz
//! to the centre of the face at +pDz
//
SoSFFloat pPhi;
//
//! Half-length along y of the face at -pDz
//
SoSFFloat pDy1;
//
//! Half-length along x of the side at y=-pDy1 of the face at -pDz
//
SoSFFloat pDx1;
//
//! Half-length along x of the side at y=+pDy1 of the face at -pDz
//
SoSFFloat pDx2;
//
//! Half-length along y of the face at +pDz
//
SoSFFloat pDy2;
//
//! Half-length along x of the side at y=-pDy2 of the face at +pDz
//
SoSFFloat pDx3;
//
//! Half-length along x of the side at y=+pDy2 of the face at +pDz
//
SoSFFloat pDx4;
//
//! Angle with respect to the y axis from the centre of the side at
//! y=-pDy1 to the centre at y=+pDy1 of the face at -pDz
//
SoSFFloat pAlp1;
//
//! Angle with respect to the y axis from the centre of the side at
//! y=-pDy2 to the centre at y=+pDy2 of the face at +pDz
//
SoSFFloat pAlp2;
//
//! Alternate rep - required
//
SoSFNode alternateRep;
//
//! Constructor, required
//
SoTrap();
//
//! Class Initializer, required
//
static void initClass();
//
//! 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.
//
virtual void generateAlternateRep();
//
//! We better be able to clear it, too!
//
virtual void clearAlternateRep();
protected:
//
//! compute bounding Box, required
//
virtual void computeBBox(SoAction *action, SbBox3f &box, SbVec3f &center );
//
//! Generate Primitives, required
//
virtual void generatePrimitives(SoAction *action);
//
//! GetChildList, required whenever the class has hidden children
//
virtual SoChildList *getChildren() const;
//
//! Destructor, required
//
virtual ~SoTrap();
private:
//
//! Generate Children. Used to create the hidden children. Required whenever
//! the node has hidden children.
//
void generateChildren();
//
//! Used to modify hidden children when a data field is changed. Required
//! whenever the class has hidden children.
//
void updateChildren();
//
//! ChildList. Required whenever the class has hidden children.
//
SoChildList *children;
};
#ifdef WIN32
#include <SoWinEnterScope.h>
#endif
#endif
@@ -0,0 +1,169 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
//
// $Id: SoTrd.h,v 1.2 2004/06/14 09:27:37 gcosmo Exp $
// GEANT4 tag $Name: geant4-06-02 $
//
/*-----------------------------Hepvis----------------------------------------*/
/* */
/* Node: SoTrd */
/* Description: Represents the G4Trd Geant Geometry entity */
/* Author: Joe Boudreau Nov 11 1996 */
/* */
/*---------------------------------------------------------------------------*/
#ifndef HEPVis_SoTrd_h
#define HEPVis_SoTrd_h
#include <Inventor/fields/SoSFFloat.h>
#include <Inventor/fields/SoSFNode.h>
#include <Inventor/fields/SoSFBool.h>
#include <Inventor/nodes/SoShape.h>
class SoSFNode;
//! SoTrd - Inventor version of the G4Trd Geant Geometry entity
/*!
* Node: SoTrd
*
* Description: Inventor version of the G4Trd Geant Geometry entity
*
* Author: Joe Boudreau Nov 11 1996
*
* A Trd is a trapezoid with the x and y dimensions varying along z
*
* Always use Inventor Fields. This allows Inventor to detect a change to
* the data field and take the appropriate action; e.g., redraw the scene.
*
*/
#define SoTrd Geant4_SoTrd
class SoTrd:public SoShape {
//
//! This is required
//
SO_NODE_HEADER(SoTrd);
public:
//
//! half-length of x, at -fDz
//
SoSFFloat fDx1;
//
//! half-length of x, at +fDz
//
SoSFFloat fDx2;
//
//! half-length of y, at -fDz
//
SoSFFloat fDy1;
//
//! half-length of y, at +fDz
//
SoSFFloat fDy2;
//
//! half-length along Z
//
SoSFFloat fDz;
//
//! Alternate rep - required
//
SoSFNode alternateRep;
//
//! Constructor, required
//
SoTrd();
//
//! Class Initializer, required
//
static void initClass();
//
//! 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.
//
virtual void generateAlternateRep();
//
//! We better be able to clear it, too!
//
virtual void clearAlternateRep();
protected:
//
//! compute bounding Box, required
//
virtual void computeBBox(SoAction *action, SbBox3f &box, SbVec3f &center );
//
//! Generate Primitives, required
//
virtual void generatePrimitives(SoAction *action);
//
//! GetChildList, required whenever the class has hidden children
//
virtual SoChildList *getChildren() const;
protected:
//
//! Destructor, required
//
virtual ~SoTrd();
private:
//
//! Generate Children. Used to create the hidden children. Required whenever
//! the node has hidden children.
//
void generateChildren();
//
//! Used to modify hidden children when a data field is changed. Required
//! whenever the class has hidden children.
//
void updateChildren();
//
//! ChildList. Required whenever the class has hidden children.
//
SoChildList *children;
};
#endif
@@ -0,0 +1,180 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
//
// $Id: SoTubs.h,v 1.2 2004/06/14 09:27:38 gcosmo Exp $
// GEANT4 tag $Name: geant4-06-02 $
//
/*-----------------------------Hepvis----------------------------------------*/
/* */
/* Node: SoTubs */
/* Description: Represents the G4Tubs Geant Geometry entity */
/* Author: Joe Boudreau Nov 11 1996 */
/* */
/*---------------------------------------------------------------------------*/
#ifndef HEPVis_SoTubs_h
#define HEPVis_SoTubs_h
#include <Inventor/fields/SoSFFloat.h>
#include <Inventor/fields/SoSFNode.h>
#include <Inventor/fields/SoSFBool.h>
#include <Inventor/nodes/SoShape.h>
class SoSFNode;
//! SoTubs - Inventor version of the G4Tubs Geant Geometry entity
/*!
* Node: SoTubs
*
* Description: The Inventor version of the G4Tubs Geant Geometry entity
*
* Author: Joe Boudreau Nov 11 1996
*
* class G4Tubs
*
* A tube or tube segment with curved sides parallel to
* the z-axis. The tube has a specified half-length along
* the z axis, about which it is centred, and a given
* minimum and maximum radius. A minimum radius of 0
* signifies a filled tube /cylinder. The tube segment is
* specified by starting and delta
* angles for phi, with 0 being the +x axis, PI/2
* the +y axis. A delta angle of 2PI signifies a
* complete, unsegmented tube/cylinder
*
* Always use Inventor Fields. This allows Inventor to detect a change to
* the data field and take the appropriate action; e.g., redraw the scene.
*/
#define SoTubs Geant4_SoTubs
class SoTubs:public SoShape {
// The following is required:
SO_NODE_HEADER(SoTubs);
public:
//
//! Inside radius of the tube
//
SoSFFloat pRMin;
//
//! Outside radius of the tube
//
SoSFFloat pRMax;
//
//! Half-length in Z
//
SoSFFloat pDz;
//
//! Starting angle, in radians
//
SoSFFloat pSPhi;
//
//! Delta-angle, in radians
//
SoSFFloat pDPhi;
//
//! Alternate rep - required
//
SoSFNode alternateRep;
//
//! Constructor, required
//
SoTubs();
//
//! Class Initializer, required
//
static void initClass();
//
//! 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.
//
virtual void generateAlternateRep();
//
//! We better be able to clear it, too!
//
virtual void clearAlternateRep();
protected:
//
//! compute bounding Box, required
//
virtual void computeBBox(SoAction *action, SbBox3f &box, SbVec3f &center );
//
//! Generate Primitives, required
//
virtual void generatePrimitives(SoAction *action);
//
//! GetChildList, required whenever the class has hidden children
//
virtual SoChildList *getChildren() const;
protected:
//
//! Destructor, required
//
virtual ~SoTubs();
private:
//
//! Generate Children. Used to create the hidden children. Required whenever
//! the node has hidden children.
//
void generateChildren();
//
//! Used to modify hidden children when a data field is changed. Required
//! whenever the class has hidden children.
//
void updateChildren();
//
//! ChildList. Required whenever the class has hidden children.
//
SoChildList *children;
//
//! help with trigonometry. increments sines an cosines by an angle.
//
void inc(double & sinPhi, double & cosPhi, double sinDeltaPhi, double cosDeltaPhi) const {
double oldSin=sinPhi,oldCos=cosPhi;
sinPhi = oldSin*cosDeltaPhi+oldCos*sinDeltaPhi;
cosPhi = oldCos*cosDeltaPhi-oldSin*sinDeltaPhi;
}
};
#endif