Import Geant4 2.0.0 source tree
This commit is contained in:
@@ -6,7 +6,7 @@
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4Circle.hh,v 1.4 1999/12/15 14:50:31 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-01-01 $
|
||||
// GEANT4 tag $Name: geant4-02-00 $
|
||||
//
|
||||
//
|
||||
// John Allison 17/11/96.
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4Circle.icc,v 1.3 1999/12/15 14:50:32 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-01-01 $
|
||||
// GEANT4 tag $Name: geant4-02-00 $
|
||||
//
|
||||
//
|
||||
// John Allison 17/11/96.
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4Color.hh,v 1.3 1999/12/15 14:50:32 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-01-01 $
|
||||
// GEANT4 tag $Name: geant4-02-00 $
|
||||
//
|
||||
//
|
||||
// John Allison 20th October 1996
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4Colour.hh,v 1.5 1999/12/15 16:46:07 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-01-01 $
|
||||
// GEANT4 tag $Name: geant4-02-00 $
|
||||
//
|
||||
//
|
||||
// John Allison 20th October 1996
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4NURBS.hh,v 1.5 1999/12/15 14:50:32 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-01-01 $
|
||||
// GEANT4 tag $Name: geant4-02-00 $
|
||||
//
|
||||
// Olivier Crumeyrolle 12 September 1996
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4NURBSbox.hh,v 1.5 1999/12/15 14:50:32 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-01-01 $
|
||||
// GEANT4 tag $Name: geant4-02-00 $
|
||||
//
|
||||
//
|
||||
// Olivier Crumeyrolle 12 September 1996
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4NURBScylinder.hh,v 1.5 1999/12/15 14:50:32 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-01-01 $
|
||||
// GEANT4 tag $Name: geant4-02-00 $
|
||||
//
|
||||
//
|
||||
// Olivier Crumeyrolle 12 September 1996
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4NURBShexahedron.hh,v 1.5 1999/12/15 14:50:32 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-01-01 $
|
||||
// GEANT4 tag $Name: geant4-02-00 $
|
||||
//
|
||||
// Hexa hedron builder prototype
|
||||
// OC 17 9 96
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4NURBStube.hh,v 1.5 1999/12/15 14:50:32 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-01-01 $
|
||||
// GEANT4 tag $Name: geant4-02-00 $
|
||||
//
|
||||
//
|
||||
// Olivier Crumeyrolle 12 September 1996
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4NURBStubesector.hh,v 1.4 1999/12/15 14:50:32 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-01-01 $
|
||||
// GEANT4 tag $Name: geant4-02-00 $
|
||||
//
|
||||
//
|
||||
// Olivier Crumeyrolle 12 September 1996
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4PlacedPolyhedron.hh,v 1.7 1999/12/15 14:50:32 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-01-01 $
|
||||
// GEANT4 tag $Name: geant4-02-00 $
|
||||
|
||||
|
||||
// Class Description:
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4Point3DList.hh,v 1.6 1999/12/15 16:46:08 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-01-01 $
|
||||
// GEANT4 tag $Name: geant4-02-00 $
|
||||
//
|
||||
//
|
||||
// John Allison July 1995
|
||||
|
||||
@@ -5,18 +5,21 @@
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4Polyhedron.hh,v 1.5 1999/12/16 15:26:03 johna Exp $
|
||||
// GEANT4 tag $Name: geant4-01-01 $
|
||||
//
|
||||
//
|
||||
//
|
||||
// $Id: G4Polyhedron.hh,v 1.8 2000/03/30 16:01:41 stesting Exp $
|
||||
// GEANT4 tag $Name: geant4-02-00 $
|
||||
|
||||
#ifndef G4POLYHEDRON_HH
|
||||
#define G4POLYHEDRON_HH
|
||||
|
||||
// Class Description:
|
||||
// G4Polyhedron is an intermediate class between G4 and visualization
|
||||
// systems. It is intended to provide some service like:
|
||||
// - polygonization of the G4 shapes with triangulization
|
||||
// (quadrilaterization) of complex polygons;
|
||||
// - calculation of normals for faces and vertices;
|
||||
// - calculation of normals for faces and vertices.
|
||||
//
|
||||
// Inherits from HepPolyhedron, to which reference should be made for
|
||||
// functionality.
|
||||
//
|
||||
// Public constructors:
|
||||
// G4PolyhedronBox(dx,dy,dz) - create G4Polyhedron for G4 Box;
|
||||
@@ -47,7 +50,8 @@
|
||||
// G4PolyhedronTorus(rmin,rmax,rtor,
|
||||
// phi,dphi) - create G4Polyhedron for Torus;
|
||||
//
|
||||
// Public functions:
|
||||
// Public functions inherited from HepPolyhedron (this list might be
|
||||
// incomplete):
|
||||
// GetNoVertices() - returns number of vertices
|
||||
// GetNoFacets() - returns number of faces
|
||||
// GetNextVertexIndex(index, edgeFlag) - get vertex indeces of the
|
||||
@@ -69,315 +73,232 @@
|
||||
// GetNextEdge(p1, p2, edgeFlag) - get next edge;
|
||||
// returns false for the last edge;
|
||||
// SetNumberOfRotationSteps(G4int n) - Set number of steps for whole circle;
|
||||
// Class Description - End:
|
||||
|
||||
// History:
|
||||
// 20.06.96 Evgeni Chernyaev <Evgueni.Tcherniaev@cern.ch> - initial version
|
||||
//
|
||||
// 23.07.96 John Allison
|
||||
// - added GetNoVertices, GetNoFacets, GetNextVertex, GetNextNormal
|
||||
//
|
||||
// 30.09.96 E.Chernyaev
|
||||
// - added GetNextVertexIndex, GetVertex by Yasuhide Sawada
|
||||
// - added GetNextUnitNormal, GetNextEdgeIndeces, GetNextEdge
|
||||
// - improvements: angles now expected in radians
|
||||
// int -> G4int, double -> G4double
|
||||
// - G4ThreeVector replaced by either G4Point3D or G4Normal3D
|
||||
//
|
||||
// 15.12.96 E.Chernyaev
|
||||
// - private functions G4PolyhedronAlloc, G4PolyhedronPrism renamed
|
||||
// to AllocateMemory and CreatePrism
|
||||
// - added private functions GetNumberOfRotationSteps, RotateEdge,
|
||||
// RotateAroundZ, SetReferences
|
||||
// - rewritten G4PolyhedronCons;
|
||||
// - added G4PolyhedronPara, ...Trap, ...Pgon, ...Pcon, ...Sphere, ...Torus,
|
||||
// so full List of implemented shapes now looks like:
|
||||
// BOX, TRD1, TRD2, TRAP, TUBE, TUBS, CONE, CONS, PARA, PGON, PCON,
|
||||
// SPHERE, TORUS
|
||||
//
|
||||
// 01.06.97 E.Chernyaev
|
||||
// - RotateAroundZ modified and SetSideFacets added to allow Rmin=Rmax
|
||||
// in bodies of revolution
|
||||
//
|
||||
// 24.06.97 J.Allison
|
||||
// - added static private member fNumberOfRotationSteps and static public
|
||||
// functions void SetNumberOfRotationSteps (G4int n) and
|
||||
// void ResetNumberOfRotationSteps (). Modified
|
||||
// GetNumberOfRotationSteps() appropriately. Made all three functions
|
||||
// inline (at end of this .hh file).
|
||||
// Usage:
|
||||
// G4Polyhedron::SetNumberOfRotationSteps
|
||||
// (fpView -> GetViewParameters ().GetNoOfSides ());
|
||||
// pPolyhedron = solid.CreatePolyhedron ();
|
||||
// G4Polyhedron::ResetNumberOfRotationSteps ();
|
||||
// 21st February 2000 Evgeni Chernaev, John Allison
|
||||
// - Re-written to inherit HepPolyhedron.
|
||||
|
||||
|
||||
#ifndef G4POLYHEDRON_HH
|
||||
#define G4POLYHEDRON_HH
|
||||
|
||||
#include "G4ios.hh"
|
||||
#include "globals.hh"
|
||||
#include "HepPolyhedron.h"
|
||||
#include "G4VVisPrim.hh"
|
||||
#include "G4Point3D.hh"
|
||||
#include "G4Normal3D.hh"
|
||||
#include "G4Vector3D.hh"
|
||||
#include "G4Transform3D.hh"
|
||||
|
||||
class G4Facet {
|
||||
friend class G4Polyhedron;
|
||||
friend G4std::ostream& operator<<(G4std::ostream&, const G4Facet &facet);
|
||||
|
||||
private:
|
||||
struct G4Edge { G4int v,f; };
|
||||
G4Edge edge[4];
|
||||
|
||||
public: // With description
|
||||
|
||||
G4Facet(G4int v1=0, G4int f1=0, G4int v2=0, G4int f2=0,
|
||||
G4int v3=0, G4int f3=0, G4int v4=0, G4int f4=0)
|
||||
{ edge[0].v=v1; edge[0].f=f1; edge[1].v=v2; edge[1].f=f2;
|
||||
edge[2].v=v3; edge[2].f=f3; edge[3].v=v4; edge[3].f=f4; }
|
||||
class G4Polyhedron : public HepPolyhedron, public G4VVisPrim {
|
||||
public:
|
||||
G4Polyhedron ();
|
||||
G4Polyhedron (const G4Polyhedron& from);
|
||||
G4Polyhedron (const HepPolyhedron& from);
|
||||
virtual G4Visible& operator = (const G4Visible& from) {
|
||||
return G4Visible::operator = (from);
|
||||
}
|
||||
virtual G4VVisPrim& operator = (const G4VVisPrim& from) {
|
||||
return G4VVisPrim::operator = (from);
|
||||
}
|
||||
virtual HepPolyhedron& operator = (const HepPolyhedron& from) {
|
||||
return HepPolyhedron::operator = (from);
|
||||
}
|
||||
G4Polyhedron& operator = (const G4Polyhedron& from);
|
||||
};
|
||||
|
||||
class G4Polyhedron: public G4VVisPrim {
|
||||
friend G4std::ostream& operator<<(G4std::ostream&, const G4Polyhedron &ph);
|
||||
|
||||
private:
|
||||
static G4int fNumberOfRotationSteps;
|
||||
|
||||
protected:
|
||||
G4int nvert, nface;
|
||||
G4Point3D *pV;
|
||||
G4Facet *pF;
|
||||
|
||||
// Allocate memory for G4Polyhedron
|
||||
void AllocateMemory(G4int Nvert, G4int Nface);
|
||||
|
||||
// Create G4Polyhedron for prism with quadrilateral base
|
||||
void CreatePrism();
|
||||
|
||||
// Get number of steps for whole circle
|
||||
G4int GetNumberOfRotationSteps();
|
||||
|
||||
// Generate facets by revolving an edge around Z-axis
|
||||
void RotateEdge(G4int k1, G4int k2, G4double r1, G4double r2,
|
||||
G4int v1, G4int v2, G4int vEdge,
|
||||
G4bool ifWholeCircle, G4int ns, G4int &kface);
|
||||
|
||||
// Set side facets for the case of incomplete rotation
|
||||
void SetSideFacets(G4int ii[4], G4int vv[4],
|
||||
G4int *kk, G4double *r,
|
||||
G4double dphi, G4int ns, G4int &kface);
|
||||
|
||||
// Create G4Polyhedron for body of revolution around Z-axis
|
||||
void RotateAroundZ(G4int nstep, G4double phi, G4double dphi,
|
||||
G4int np1, G4int np2,
|
||||
const G4double *z, G4double *r,
|
||||
G4int nodeVis, G4int edgeVis);
|
||||
|
||||
// For each edge set reference to neighbouring facet
|
||||
void SetReferences();
|
||||
|
||||
// Invert the order on nodes in facets
|
||||
void InvertFacets();
|
||||
|
||||
public:
|
||||
// Constructor
|
||||
G4Polyhedron(G4int Nvert=0, G4int Nface=0)
|
||||
: nvert(Nvert), nface(Nface),
|
||||
pV(Nvert ? new G4Point3D[Nvert+1] : 0),
|
||||
pF(Nface ? new G4Facet[Nface+1] : 0) {}
|
||||
|
||||
// Copy constructor
|
||||
G4Polyhedron(const G4Polyhedron &from);
|
||||
|
||||
// Destructor
|
||||
~G4Polyhedron() { delete [] pV; delete [] pF; }
|
||||
|
||||
// Assignment
|
||||
virtual G4Visible& operator=(const G4Visible &from);
|
||||
virtual G4VVisPrim& operator=(const G4VVisPrim &from);
|
||||
G4Polyhedron& operator=(const G4Polyhedron &from);
|
||||
|
||||
// Get number of vertices
|
||||
G4int GetNoVertices() const { return nvert; }
|
||||
|
||||
// Get number of facets
|
||||
G4int GetNoFacets() const { return nface; }
|
||||
|
||||
// Transform the polyhedron
|
||||
G4Polyhedron & Transform(const G4Transform3D &t);
|
||||
|
||||
// Get next vertex index of the quadrilateral
|
||||
G4bool GetNextVertexIndex(G4int &index, G4int &edgeFlag) const;
|
||||
|
||||
// Get vertex by index
|
||||
G4Point3D GetVertex(G4int index) const;
|
||||
|
||||
// Get next vertex + edge visibility of the quadrilateral
|
||||
G4bool GetNextVertex(G4Point3D &vertex, G4int &edgeFlag) const;
|
||||
|
||||
// Get next vertex + edge visibility + normal of the quadrilateral
|
||||
//G4bool GetNextVertex
|
||||
//(G4Point3D &vertex, G4int &edgeFlag, G4Normal3D &normal) const;
|
||||
|
||||
// Get normal of the next face
|
||||
G4bool GetNextNormal(G4Normal3D &normal) const;
|
||||
|
||||
// Get normal of unit length of the next face
|
||||
G4bool GetNextUnitNormal(G4Normal3D &normal) const;
|
||||
|
||||
// Get indeces of the next edge
|
||||
G4bool GetNextEdgeIndeces(G4int &i1, G4int &i2, G4int &edgeFlag) const;
|
||||
|
||||
// Get next edge
|
||||
G4bool GetNextEdge(G4Point3D &p1, G4Point3D &p2, G4int &edgeFlag) const;
|
||||
|
||||
// Set number of steps for whole circle
|
||||
static void SetNumberOfRotationSteps(G4int n);
|
||||
|
||||
// Reset number of steps for whole circle to default value
|
||||
static void ResetNumberOfRotationSteps();
|
||||
class G4PolyhedronBox: public G4Polyhedron {
|
||||
public:
|
||||
G4PolyhedronBox (G4double dx, G4double dy, G4double dz);
|
||||
virtual G4Visible& operator = (const G4Visible& from) {
|
||||
return G4Visible::operator = (from);
|
||||
}
|
||||
virtual G4VVisPrim& operator = (const G4VVisPrim& from) {
|
||||
return G4VVisPrim::operator = (from);
|
||||
}
|
||||
virtual HepPolyhedron& operator = (const HepPolyhedron& from) {
|
||||
return HepPolyhedron::operator = (from);
|
||||
}
|
||||
};
|
||||
|
||||
class G4PolyhedronTrd2 : public G4Polyhedron {
|
||||
public:
|
||||
G4PolyhedronTrd2(G4double Dx1, G4double Dx2,
|
||||
G4double Dy1, G4double Dy2, G4double Dz);
|
||||
virtual G4Visible& operator=(const G4Visible &from);
|
||||
virtual G4VVisPrim& operator=(const G4VVisPrim &from);
|
||||
class G4PolyhedronCone: public G4Polyhedron {
|
||||
public:
|
||||
G4PolyhedronCone (G4double Rmn1, G4double Rmx1,
|
||||
G4double Rmn2, G4double Rmx2, G4double Dz);
|
||||
virtual G4Visible& operator = (const G4Visible& from) {
|
||||
return G4Visible::operator = (from);
|
||||
}
|
||||
virtual G4VVisPrim& operator = (const G4VVisPrim& from) {
|
||||
return G4VVisPrim::operator = (from);
|
||||
}
|
||||
virtual HepPolyhedron& operator = (const HepPolyhedron& from) {
|
||||
return HepPolyhedron::operator = (from);
|
||||
}
|
||||
};
|
||||
|
||||
class G4PolyhedronTrd1 : public G4PolyhedronTrd2 {
|
||||
public:
|
||||
G4PolyhedronTrd1(G4double Dx1, G4double Dx2, G4double Dy, G4double Dz) :
|
||||
G4PolyhedronTrd2(Dx1, Dx2, Dy, Dy, Dz) {}
|
||||
virtual G4Visible& operator=(const G4Visible &from);
|
||||
virtual G4VVisPrim& operator=(const G4VVisPrim &from);
|
||||
class G4PolyhedronCons: public G4Polyhedron {
|
||||
public:
|
||||
G4PolyhedronCons (G4double Rmn1, G4double Rmx1,
|
||||
G4double Rmn2, G4double Rmx2, G4double Dz,
|
||||
G4double Phi1, G4double Dphi);
|
||||
virtual G4Visible& operator = (const G4Visible& from) {
|
||||
return G4Visible::operator = (from);
|
||||
}
|
||||
virtual G4VVisPrim& operator = (const G4VVisPrim& from) {
|
||||
return G4VVisPrim::operator = (from);
|
||||
}
|
||||
virtual HepPolyhedron& operator = (const HepPolyhedron& from) {
|
||||
return HepPolyhedron::operator = (from);
|
||||
}
|
||||
};
|
||||
|
||||
class G4PolyhedronBox : public G4PolyhedronTrd2 {
|
||||
public:
|
||||
G4PolyhedronBox(G4double Dx, G4double Dy, G4double Dz) :
|
||||
G4PolyhedronTrd2(Dx, Dx, Dy, Dy, Dz) {}
|
||||
virtual G4Visible& operator=(const G4Visible &from);
|
||||
virtual G4VVisPrim& operator=(const G4VVisPrim &from);
|
||||
class G4PolyhedronPara: public G4Polyhedron {
|
||||
public:
|
||||
G4PolyhedronPara (G4double Dx, G4double Dy, G4double Dz,
|
||||
G4double Alpha, G4double Theta, G4double Phi);
|
||||
virtual G4Visible& operator = (const G4Visible& from) {
|
||||
return G4Visible::operator = (from);
|
||||
}
|
||||
virtual G4VVisPrim& operator = (const G4VVisPrim& from) {
|
||||
return G4VVisPrim::operator = (from);
|
||||
}
|
||||
virtual HepPolyhedron& operator = (const HepPolyhedron& from) {
|
||||
return HepPolyhedron::operator = (from);
|
||||
}
|
||||
};
|
||||
|
||||
class G4PolyhedronTrap : public G4Polyhedron {
|
||||
public:
|
||||
G4PolyhedronTrap(G4double Dz, G4double Theta, G4double Phi,
|
||||
G4double Dy1, G4double Dx1, G4double Dx2, G4double Alp1,
|
||||
G4double Dy2, G4double Dx3, G4double Dx4, G4double Alp2);
|
||||
virtual G4Visible& operator=(const G4Visible &from);
|
||||
virtual G4VVisPrim& operator=(const G4VVisPrim &from);
|
||||
class G4PolyhedronPcon: public G4Polyhedron {
|
||||
public:
|
||||
G4PolyhedronPcon (G4double phi, G4double dphi, G4int nz,
|
||||
const G4double *z,
|
||||
const G4double *rmin,
|
||||
const G4double *rmax);
|
||||
virtual G4Visible& operator = (const G4Visible& from) {
|
||||
return G4Visible::operator = (from);
|
||||
}
|
||||
virtual G4VVisPrim& operator = (const G4VVisPrim& from) {
|
||||
return G4VVisPrim::operator = (from);
|
||||
}
|
||||
virtual HepPolyhedron& operator = (const HepPolyhedron& from) {
|
||||
return HepPolyhedron::operator = (from);
|
||||
}
|
||||
};
|
||||
|
||||
class G4PolyhedronPara : public G4PolyhedronTrap {
|
||||
public:
|
||||
G4PolyhedronPara(G4double Dx, G4double Dy, G4double Dz,
|
||||
G4double Alpha, G4double Theta, G4double Phi) :
|
||||
G4PolyhedronTrap(Dz, Theta, Phi, Dy, Dx, Dx, Alpha, Dy, Dx, Dx, Alpha) {}
|
||||
virtual G4Visible& operator=(const G4Visible &from);
|
||||
virtual G4VVisPrim& operator=(const G4VVisPrim &from);
|
||||
class G4PolyhedronPgon: public G4Polyhedron {
|
||||
public:
|
||||
G4PolyhedronPgon (G4double phi, G4double dphi, G4int npdv, G4int nz,
|
||||
const G4double *z,
|
||||
const G4double *rmin,
|
||||
const G4double *rmax);
|
||||
virtual G4Visible& operator = (const G4Visible& from) {
|
||||
return G4Visible::operator = (from);
|
||||
}
|
||||
virtual G4VVisPrim& operator = (const G4VVisPrim& from) {
|
||||
return G4VVisPrim::operator = (from);
|
||||
}
|
||||
virtual HepPolyhedron& operator = (const HepPolyhedron& from) {
|
||||
return HepPolyhedron::operator = (from);
|
||||
}
|
||||
};
|
||||
|
||||
class G4PolyhedronCons : public G4Polyhedron {
|
||||
public:
|
||||
G4PolyhedronCons(G4double Rmn1, G4double Rmx1,
|
||||
G4double Rmn2, G4double Rmx2, G4double Dz,
|
||||
G4double Phi1, G4double Dphi);
|
||||
virtual G4Visible& operator=(const G4Visible &from);
|
||||
virtual G4VVisPrim& operator=(const G4VVisPrim &from);
|
||||
class G4PolyhedronSphere: public G4Polyhedron {
|
||||
public:
|
||||
G4PolyhedronSphere (G4double rmin, G4double rmax,
|
||||
G4double phi, G4double dphi,
|
||||
G4double the, G4double dthe);
|
||||
virtual G4Visible& operator = (const G4Visible& from) {
|
||||
return G4Visible::operator = (from);
|
||||
}
|
||||
virtual G4VVisPrim& operator = (const G4VVisPrim& from) {
|
||||
return G4VVisPrim::operator = (from);
|
||||
}
|
||||
virtual HepPolyhedron& operator = (const HepPolyhedron& from) {
|
||||
return HepPolyhedron::operator = (from);
|
||||
}
|
||||
};
|
||||
|
||||
class G4PolyhedronCone : public G4PolyhedronCons {
|
||||
public:
|
||||
G4PolyhedronCone(G4double Rmn1, G4double Rmx1,
|
||||
G4double Rmn2, G4double Rmx2, G4double Dz)
|
||||
: G4PolyhedronCons(Rmn1, Rmx1, Rmn2, Rmx2, Dz, 0*deg, 360*deg) {}
|
||||
virtual G4Visible& operator=(const G4Visible &from);
|
||||
virtual G4VVisPrim& operator=(const G4VVisPrim &from);
|
||||
};
|
||||
|
||||
class G4PolyhedronTubs : public G4PolyhedronCons {
|
||||
public:
|
||||
G4PolyhedronTubs(G4double Rmin, G4double Rmax, G4double Dz,
|
||||
G4double Phi1, G4double Dphi)
|
||||
: G4PolyhedronCons(Rmin, Rmax, Rmin, Rmax, Dz, Phi1, Dphi) {}
|
||||
virtual G4Visible& operator=(const G4Visible &from);
|
||||
virtual G4VVisPrim& operator=(const G4VVisPrim &from);
|
||||
};
|
||||
|
||||
class G4PolyhedronTube : public G4PolyhedronCons {
|
||||
public:
|
||||
G4PolyhedronTube (G4double Rmin, G4double Rmax, G4double Dz)
|
||||
: G4PolyhedronCons(Rmin, Rmax, Rmin, Rmax, Dz, 0*deg, 360*deg) {}
|
||||
virtual G4Visible& operator=(const G4Visible &from);
|
||||
virtual G4VVisPrim& operator=(const G4VVisPrim &from);
|
||||
};
|
||||
|
||||
class G4PolyhedronPgon : public G4Polyhedron {
|
||||
public:
|
||||
G4PolyhedronPgon(G4double phi, G4double dphi, G4int npdv, G4int nz,
|
||||
const G4double *z,
|
||||
const G4double *rmin,
|
||||
const G4double *rmax);
|
||||
virtual G4Visible& operator=(const G4Visible &from);
|
||||
virtual G4VVisPrim& operator=(const G4VVisPrim &from);
|
||||
};
|
||||
|
||||
class G4PolyhedronPcon : public G4PolyhedronPgon {
|
||||
public:
|
||||
G4PolyhedronPcon(G4double phi, G4double dphi, G4int nz,
|
||||
const G4double *z,
|
||||
const G4double *rmin,
|
||||
const G4double *rmax)
|
||||
: G4PolyhedronPgon(phi, dphi, 0, nz, z, rmin, rmax) {}
|
||||
virtual G4Visible& operator=(const G4Visible &from);
|
||||
virtual G4VVisPrim& operator=(const G4VVisPrim &from);
|
||||
};
|
||||
|
||||
class G4PolyhedronSphere : public G4Polyhedron {
|
||||
public:
|
||||
G4PolyhedronSphere(G4double rmin, G4double rmax,
|
||||
G4double phi, G4double dphi,
|
||||
G4double the, G4double dthe);
|
||||
virtual G4Visible& operator=(const G4Visible &from);
|
||||
virtual G4VVisPrim& operator=(const G4VVisPrim &from);
|
||||
};
|
||||
|
||||
class G4PolyhedronTorus : public G4Polyhedron {
|
||||
public:
|
||||
G4PolyhedronTorus(G4double rmin, G4double rmax, G4double rtor,
|
||||
class G4PolyhedronTorus: public G4Polyhedron {
|
||||
public:
|
||||
G4PolyhedronTorus (G4double rmin, G4double rmax, G4double rtor,
|
||||
G4double phi, G4double dphi);
|
||||
virtual G4Visible& operator=(const G4Visible &from);
|
||||
virtual G4VVisPrim& operator=(const G4VVisPrim &from);
|
||||
virtual G4Visible& operator = (const G4Visible& from) {
|
||||
return G4Visible::operator = (from);
|
||||
}
|
||||
virtual G4VVisPrim& operator = (const G4VVisPrim& from) {
|
||||
return G4VVisPrim::operator = (from);
|
||||
}
|
||||
virtual HepPolyhedron& operator = (const HepPolyhedron& from) {
|
||||
return HepPolyhedron::operator = (from);
|
||||
}
|
||||
};
|
||||
|
||||
inline G4int G4Polyhedron::GetNumberOfRotationSteps()
|
||||
/***********************************************************************
|
||||
* *
|
||||
* Name: G4Polyhedron::GetNumberOfRotationSteps Date: 11.12.96 *
|
||||
* Author: E.Chernyaev (IHEP/Protvino) Revised: 24.06.97 *
|
||||
* *
|
||||
* Function: Get number of steps for whole circle *
|
||||
* *
|
||||
***********************************************************************/
|
||||
{
|
||||
return fNumberOfRotationSteps;
|
||||
}
|
||||
class G4PolyhedronTrap: public G4Polyhedron {
|
||||
public:
|
||||
G4PolyhedronTrap (G4double Dz, G4double Theta, G4double Phi,
|
||||
G4double Dy1,
|
||||
G4double Dx1, G4double Dx2, G4double Alp1,
|
||||
G4double Dy2,
|
||||
G4double Dx3, G4double Dx4, G4double Alp2);
|
||||
virtual G4Visible& operator = (const G4Visible& from) {
|
||||
return G4Visible::operator = (from);
|
||||
}
|
||||
virtual G4VVisPrim& operator = (const G4VVisPrim& from) {
|
||||
return G4VVisPrim::operator = (from);
|
||||
}
|
||||
virtual HepPolyhedron& operator = (const HepPolyhedron& from) {
|
||||
return HepPolyhedron::operator = (from);
|
||||
}
|
||||
};
|
||||
|
||||
inline void G4Polyhedron::ResetNumberOfRotationSteps()
|
||||
/***********************************************************************
|
||||
* *
|
||||
* Name: G4Polyhedron::ResetNumberOfRotationSteps Date: 24.06.97 *
|
||||
* Author: J.Allison (Manchester University) Revised: *
|
||||
* *
|
||||
* Function: Reset number of steps for whole circle to default value *
|
||||
* *
|
||||
***********************************************************************/
|
||||
{
|
||||
fNumberOfRotationSteps = 24;
|
||||
}
|
||||
class G4PolyhedronTrd1: public G4Polyhedron {
|
||||
public:
|
||||
G4PolyhedronTrd1 (G4double Dx1, G4double Dx2,
|
||||
G4double Dy, G4double Dz);
|
||||
virtual G4Visible& operator = (const G4Visible& from) {
|
||||
return G4Visible::operator = (from);
|
||||
}
|
||||
virtual G4VVisPrim& operator = (const G4VVisPrim& from) {
|
||||
return G4VVisPrim::operator = (from);
|
||||
}
|
||||
virtual HepPolyhedron& operator = (const HepPolyhedron& from) {
|
||||
return HepPolyhedron::operator = (from);
|
||||
}
|
||||
};
|
||||
|
||||
class G4PolyhedronTrd2: public G4Polyhedron {
|
||||
public:
|
||||
G4PolyhedronTrd2 (G4double Dx1, G4double Dx2,
|
||||
G4double Dy1, G4double Dy2, G4double Dz);
|
||||
virtual G4Visible& operator = (const G4Visible& from) {
|
||||
return G4Visible::operator = (from);
|
||||
}
|
||||
virtual G4VVisPrim& operator = (const G4VVisPrim& from) {
|
||||
return G4VVisPrim::operator = (from);
|
||||
}
|
||||
virtual HepPolyhedron& operator = (const HepPolyhedron& from) {
|
||||
return HepPolyhedron::operator = (from);
|
||||
}
|
||||
};
|
||||
|
||||
class G4PolyhedronTube: public G4Polyhedron {
|
||||
public:
|
||||
G4PolyhedronTube (G4double Rmin, G4double Rmax, G4double Dz);
|
||||
virtual G4Visible& operator = (const G4Visible& from) {
|
||||
return G4Visible::operator = (from);
|
||||
}
|
||||
virtual G4VVisPrim& operator = (const G4VVisPrim& from) {
|
||||
return G4VVisPrim::operator = (from);
|
||||
}
|
||||
virtual HepPolyhedron& operator = (const HepPolyhedron& from) {
|
||||
return HepPolyhedron::operator = (from);
|
||||
}
|
||||
};
|
||||
|
||||
class G4PolyhedronTubs: public G4Polyhedron {
|
||||
public:
|
||||
G4PolyhedronTubs (G4double Rmin, G4double Rmax, G4double Dz,
|
||||
G4double Phi1, G4double Dphi);
|
||||
virtual G4Visible& operator = (const G4Visible& from) {
|
||||
return G4Visible::operator = (from);
|
||||
}
|
||||
virtual G4VVisPrim& operator = (const G4VVisPrim& from) {
|
||||
return G4VVisPrim::operator = (from);
|
||||
}
|
||||
virtual HepPolyhedron& operator = (const HepPolyhedron& from) {
|
||||
return HepPolyhedron::operator = (from);
|
||||
}
|
||||
};
|
||||
|
||||
#endif /* G4POLYHEDRON_HH */
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4Polyline.hh,v 1.5 1999/12/15 14:50:33 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-01-01 $
|
||||
// GEANT4 tag $Name: geant4-02-00 $
|
||||
//
|
||||
//
|
||||
// John Allison July 1995
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4Polymarker.hh,v 1.5 1999/12/15 14:50:33 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-01-01 $
|
||||
// GEANT4 tag $Name: geant4-02-00 $
|
||||
//
|
||||
//
|
||||
// John Allison November 1996
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4Polymarker.icc,v 1.2 1999/12/15 14:50:33 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-01-01 $
|
||||
// GEANT4 tag $Name: geant4-02-00 $
|
||||
//
|
||||
//
|
||||
// John Allison November 1996
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4Square.hh,v 1.4 1999/12/15 14:50:34 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-01-01 $
|
||||
// GEANT4 tag $Name: geant4-02-00 $
|
||||
//
|
||||
//
|
||||
// John Allison 17/11/96.
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4Square.icc,v 1.2 1999/12/15 14:50:34 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-01-01 $
|
||||
// GEANT4 tag $Name: geant4-02-00 $
|
||||
//
|
||||
//
|
||||
// John Allison 17/11/96.
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4Text.hh,v 1.5 1999/12/15 14:50:34 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-01-01 $
|
||||
// GEANT4 tag $Name: geant4-02-00 $
|
||||
//
|
||||
//
|
||||
// John Allison 17/11/96.
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4Text.icc,v 1.2 1999/12/15 14:50:34 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-01-01 $
|
||||
// GEANT4 tag $Name: geant4-02-00 $
|
||||
//
|
||||
//
|
||||
// John Allison 17/11/96.
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4VMarker.hh,v 1.6 1999/12/15 14:50:34 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-01-01 $
|
||||
// GEANT4 tag $Name: geant4-02-00 $
|
||||
//
|
||||
//
|
||||
// G4VMarker - base class for markers - circles, squares, etc.
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4VMarker.icc,v 1.4 1999/12/16 15:22:05 johna Exp $
|
||||
// GEANT4 tag $Name: geant4-01-01 $
|
||||
// GEANT4 tag $Name: geant4-02-00 $
|
||||
//
|
||||
//
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4VVisPrim.hh,v 1.6 1999/12/15 16:46:08 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-01-01 $
|
||||
// GEANT4 tag $Name: geant4-02-00 $
|
||||
//
|
||||
//
|
||||
// John Allison August 1995
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4VVisPrim.icc,v 1.3 1999/12/15 14:50:34 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-01-01 $
|
||||
// GEANT4 tag $Name: geant4-02-00 $
|
||||
//
|
||||
//
|
||||
// John Allison August 1995
|
||||
|
||||
@@ -5,8 +5,8 @@
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4VisAttributes.hh,v 1.5 1999/12/15 14:50:34 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-01-01 $
|
||||
// $Id: G4VisAttributes.hh,v 1.6 2000/05/13 09:33:37 johna Exp $
|
||||
// GEANT4 tag $Name: geant4-02-00 $
|
||||
//
|
||||
//
|
||||
// John Allison 23rd October 1996
|
||||
@@ -43,7 +43,6 @@ class G4VisAttributes {
|
||||
|
||||
public: // With description
|
||||
|
||||
// Constructors, etc. - begin snippet.
|
||||
enum LineStyle {unbroken, dashed, dotted};
|
||||
enum ForcedDrawingStyle {wireframe, solid};
|
||||
|
||||
@@ -53,7 +52,6 @@ public: // With description
|
||||
G4VisAttributes (G4bool visibility, const G4Colour& colour);
|
||||
|
||||
static const G4VisAttributes Invisible;
|
||||
// Constructors - end snippet.
|
||||
|
||||
G4bool operator != (const G4VisAttributes& a) const;
|
||||
G4bool operator == (const G4VisAttributes& a) const;
|
||||
@@ -67,7 +65,6 @@ public: // With description
|
||||
G4bool IsForceDrawingStyle () const;
|
||||
ForcedDrawingStyle GetForcedDrawingStyle () const;
|
||||
|
||||
// Set methods - begin snippet.
|
||||
void SetVisibility (G4bool);
|
||||
void SetDaughtersInvisible (G4bool);
|
||||
void SetColour (const G4Colour&);
|
||||
@@ -80,11 +77,9 @@ public: // With description
|
||||
void SetLineWidth (G4double);
|
||||
void SetForceWireframe (G4bool);
|
||||
void SetForceSolid (G4bool);
|
||||
// Set methods - end snippet.
|
||||
|
||||
private:
|
||||
|
||||
// Available attributes - begin snippet.
|
||||
G4bool fVisible; // Visibility flag
|
||||
G4bool fDaughtersInvisible; // Make daughters invsibile.
|
||||
G4Colour fColour;
|
||||
@@ -93,7 +88,6 @@ private:
|
||||
// pixels for screen, 0.1 mm for paper.
|
||||
G4bool fForceDrawingStyle; // To override view parameters.
|
||||
ForcedDrawingStyle fForcedStyle;
|
||||
// Available attributes - end snippet.
|
||||
};
|
||||
|
||||
#include "G4VisAttributes.icc"
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4VisAttributes.icc,v 1.3 1999/12/15 14:50:34 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-01-01 $
|
||||
// GEANT4 tag $Name: geant4-02-00 $
|
||||
//
|
||||
//
|
||||
// John Allison 18th November 1996
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4VisExtent.hh,v 1.4 1999/12/15 14:50:35 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-01-01 $
|
||||
// GEANT4 tag $Name: geant4-02-00 $
|
||||
//
|
||||
//
|
||||
// A.Walkden 28/11/95
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4Visible.hh,v 1.6 1999/12/15 16:46:08 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-01-01 $
|
||||
// GEANT4 tag $Name: geant4-02-00 $
|
||||
//
|
||||
//
|
||||
// John Allison 30th October 1996
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4Visible.icc,v 1.3 1999/12/15 14:50:35 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-01-01 $
|
||||
// GEANT4 tag $Name: geant4-02-00 $
|
||||
//
|
||||
//
|
||||
// John Allison 30th October 1996
|
||||
|
||||
@@ -0,0 +1,439 @@
|
||||
// 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: HepPolyhedron.h,v 1.4 2000/04/18 10:03:06 evc Exp $
|
||||
// GEANT4 tag $Name: geant4-02-00 $
|
||||
//
|
||||
//
|
||||
// Class Description:
|
||||
// HepPolyhedron is an intermediate class between description of a shape
|
||||
// and visualization systems. It is intended to provide some service like:
|
||||
// - polygonization of shapes with triangulization (quadrilaterization)
|
||||
// of complex polygons;
|
||||
// - calculation of normals for faces and vertices;
|
||||
// - finding result of boolean operation on polyhedra;
|
||||
//
|
||||
// Public constructors:
|
||||
//
|
||||
// HepPolyhedronBox (dx,dy,dz)
|
||||
// - create polyhedron for Box;
|
||||
// HepPolyhedronTrd1 (dx1,dx2,dy,dz)
|
||||
// - create polyhedron for G3 Trd1;
|
||||
// HepPolyhedronTrd2 (dx1,dx2,dy1,dy2,dz)
|
||||
// - create polyhedron for G3 Trd2;
|
||||
// HepPolyhedronTrap (dz,theta,phi, h1,bl1,tl1,alp1, h2,bl2,tl2,alp2)
|
||||
// - create polyhedron for G3 Trap;
|
||||
// HepPolyhedronPara (dx,dy,dz,alpha,theta,phi)
|
||||
// - create polyhedron for G3 Para;
|
||||
// HepPolyhedronTube (rmin,rmax,dz)
|
||||
// - create polyhedron for G3 Tube;
|
||||
// HepPolyhedronTubs (rmin,rmax,dz,phi1,dphi)
|
||||
// - create polyhedron for G3 Tubs;
|
||||
// HepPolyhedronCone (rmin1,rmax1,rmin2,rmax2,dz)
|
||||
// - create polyhedron for G3 Cone;
|
||||
// HepPolyhedronCons (rmin1,rmax1,rmin2,rmax2,dz,phi1,dphi)
|
||||
// - create polyhedron for G3 Cons;
|
||||
// HepPolyhedronPgon (phi,dphi,npdv,nz, z(*),rmin(*),rmax(*))
|
||||
// - create polyhedron for G3 Pgon;
|
||||
// HepPolyhedronPcon (phi,dphi,nz, z(*),rmin(*),rmax(*))
|
||||
// - create polyhedron for G3 Pcon;
|
||||
// HepPolyhedronSphere (rmin,rmax,phi,dphi,the,dthe)
|
||||
// - create polyhedron for Sphere;
|
||||
// HepPolyhedronTorus (rmin,rmax,rtor,phi,dphi)
|
||||
// - create polyhedron for Torus;
|
||||
// Public functions:
|
||||
//
|
||||
// GetNoVertices () - returns number of vertices;
|
||||
// GetNoFacets () - returns number of faces;
|
||||
// GetNextVertexIndex (index,edgeFlag) - get vertex indeces of the
|
||||
// quadrilaterals in order;
|
||||
// returns false when finished each face;
|
||||
// GetVertex (index) - returns vertex by index;
|
||||
// GetNextVertex (vertex,edgeFlag) - get vertices with edge visibility
|
||||
// of the quadrilaterals in order;
|
||||
// returns false when finished each face;
|
||||
// GetNextVertex (vertex,edgeFlag,normal) - get vertices with edge
|
||||
// visibility and normal of the quadrilaterals
|
||||
// in order; returns false when finished each face;
|
||||
// GetNextEdgeIndeces (i1,i2,edgeFlag) - get indeces of the next edge;
|
||||
// returns false for the last edge;
|
||||
// GetNextEdgeIndeces (i1,i2,edgeFlag,iface1,iface2) - get indeces of
|
||||
// the next edge with indeces of the faces
|
||||
// to which the edge belongs;
|
||||
// returns false for the last edge;
|
||||
// GetNextEdge (p1,p2,edgeFlag) - get next edge;
|
||||
// returns false for the last edge;
|
||||
// GetNextEdge (p1,p2,edgeFlag,iface1,iface2) - get next edge with indeces
|
||||
// of the faces to which the edge belongs;
|
||||
// returns false for the last edge;
|
||||
// GetFacet (index,n,nodes,edgeFlags=0,normals=0) - get face by index;
|
||||
// GetNextFacet (n,nodes,edgeFlags=0,normals=0) - get next face with normals
|
||||
// at the nodes; returns false for the last face;
|
||||
// GetNormal (index) - get normal of face given by index;
|
||||
// GetUnitNormal (index) - get unit normal of face given by index;
|
||||
// GetNextNormal (normal) - get normals of each face in order;
|
||||
// returns false when finished all faces;
|
||||
// GetNextUnitNormal (normal) - get normals of unit length of each face
|
||||
// in order; returns false when finished all faces;
|
||||
// SetNumberOfRotationSteps (n) - set number of steps for whole circle;
|
||||
// ResetNumberOfRotationSteps() - reset number of steps for whole circle
|
||||
// to default value;
|
||||
// History:
|
||||
//
|
||||
// 20.06.96 Evgeni Chernyaev <Evgueni.Tcherniaev@cern.ch> - initial version
|
||||
//
|
||||
// 23.07.96 John Allison
|
||||
// - added GetNoVertices, GetNoFacets, GetNextVertex, GetNextNormal
|
||||
//
|
||||
// 30.09.96 E.Chernyaev
|
||||
// - added GetNextVertexIndex, GetVertex by Yasuhide Sawada
|
||||
// - added GetNextUnitNormal, GetNextEdgeIndeces, GetNextEdge
|
||||
// - improvements: angles now expected in radians
|
||||
// int -> G4int, double -> G4double
|
||||
// - G4ThreeVector replaced by either G4Point3D or G4Normal3D
|
||||
//
|
||||
// 15.12.96 E.Chernyaev
|
||||
// - private functions G4PolyhedronAlloc, G4PolyhedronPrism renamed
|
||||
// to AllocateMemory and CreatePrism
|
||||
// - added private functions GetNumberOfRotationSteps, RotateEdge,
|
||||
// RotateAroundZ, SetReferences
|
||||
// - rewritten G4PolyhedronCons;
|
||||
// - added G4PolyhedronPara, ...Trap, ...Pgon, ...Pcon, ...Sphere, ...Torus,
|
||||
// so full List of implemented shapes now looks like:
|
||||
// BOX, TRD1, TRD2, TRAP, TUBE, TUBS, CONE, CONS, PARA, PGON, PCON,
|
||||
// SPHERE, TORUS
|
||||
//
|
||||
// 01.06.97 E.Chernyaev
|
||||
// - RotateAroundZ modified and SetSideFacets added to allow Rmin=Rmax
|
||||
// in bodies of revolution
|
||||
//
|
||||
// 24.06.97 J.Allison
|
||||
// - added static private member fNumberOfRotationSteps and static public
|
||||
// functions void SetNumberOfRotationSteps (G4int n) and
|
||||
// void ResetNumberOfRotationSteps (). Modified
|
||||
// GetNumberOfRotationSteps() appropriately. Made all three functions
|
||||
// inline (at end of this .hh file).
|
||||
// Usage:
|
||||
// G4Polyhedron::SetNumberOfRotationSteps
|
||||
// (fpView -> GetViewParameters ().GetNoOfSides ());
|
||||
// pPolyhedron = solid.CreatePolyhedron ();
|
||||
// G4Polyhedron::ResetNumberOfRotationSteps ();
|
||||
//
|
||||
// 19.03.00 E.Chernyaev
|
||||
// - added boolean operations (add, subtract, intersect) on polyhedra;
|
||||
//
|
||||
|
||||
#ifndef HEP_POLYHEDRON_HH
|
||||
#define HEP_POLYHEDRON_HH
|
||||
|
||||
#include <CLHEP/config/CLHEP.h>
|
||||
#include <CLHEP/config/iostream.h>
|
||||
#include <CLHEP/config/TemplateFunctions.h>
|
||||
#include <CLHEP/Units/SystemOfUnits.h>
|
||||
#include <CLHEP/Geometry/Point3D.h>
|
||||
#include <CLHEP/Geometry/Vector3D.h>
|
||||
#include <CLHEP/Geometry/Normal3D.h>
|
||||
#include <CLHEP/Geometry/Plane3D.h>
|
||||
#include <CLHEP/Geometry/Transform3D.h>
|
||||
|
||||
#ifndef HepStd
|
||||
#ifndef HEP_USE_STD
|
||||
#define HepStd
|
||||
#else
|
||||
#define HepStd std
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef DEFAULT_NUMBER_OF_STEPS
|
||||
#define DEFAULT_NUMBER_OF_STEPS 24
|
||||
#endif
|
||||
|
||||
class G4Facet {
|
||||
friend class HepPolyhedron;
|
||||
friend HepStd::ostream& operator<<(HepStd::ostream&, const G4Facet &facet);
|
||||
|
||||
private:
|
||||
struct G4Edge { int v,f; };
|
||||
G4Edge edge[4];
|
||||
|
||||
public:
|
||||
G4Facet(int v1=0, int f1=0, int v2=0, int f2=0,
|
||||
int v3=0, int f3=0, int v4=0, int f4=0)
|
||||
{ edge[0].v=v1; edge[0].f=f1; edge[1].v=v2; edge[1].f=f2;
|
||||
edge[2].v=v3; edge[2].f=f3; edge[3].v=v4; edge[3].f=f4; }
|
||||
};
|
||||
|
||||
class HepPolyhedron {
|
||||
friend HepStd::ostream& operator<<(HepStd::ostream&, const HepPolyhedron &ph);
|
||||
|
||||
private:
|
||||
static int fNumberOfRotationSteps;
|
||||
|
||||
protected:
|
||||
int nvert, nface;
|
||||
HepPoint3D *pV;
|
||||
G4Facet *pF;
|
||||
|
||||
// Allocate memory for HepPolyhedron
|
||||
void AllocateMemory(int Nvert, int Nface);
|
||||
|
||||
// Find neighbouring facet
|
||||
int FindNeighbour(int iFace, int iNode, int iOrder) const;
|
||||
|
||||
// Find normal at node
|
||||
HepNormal3D FindNodeNormal(int iFace, int iNode) const;
|
||||
|
||||
// Create HepPolyhedron for prism with quadrilateral base
|
||||
void CreatePrism();
|
||||
|
||||
// Get number of steps for whole circle
|
||||
int GetNumberOfRotationSteps() { return fNumberOfRotationSteps; }
|
||||
|
||||
// Generate facets by revolving an edge around Z-axis
|
||||
void RotateEdge(int k1, int k2, HepDouble r1, HepDouble r2,
|
||||
int v1, int v2, int vEdge,
|
||||
HepBoolean ifWholeCircle, int ns, int &kface);
|
||||
|
||||
// Set side facets for the case of incomplete rotation
|
||||
void SetSideFacets(int ii[4], int vv[4],
|
||||
int *kk, HepDouble *r,
|
||||
HepDouble dphi, int ns, int &kface);
|
||||
|
||||
// Create HepPolyhedron for body of revolution around Z-axis
|
||||
void RotateAroundZ(int nstep, HepDouble phi, HepDouble dphi,
|
||||
int np1, int np2,
|
||||
const HepDouble *z, HepDouble *r,
|
||||
int nodeVis, int edgeVis);
|
||||
|
||||
// For each edge set reference to neighbouring facet
|
||||
void SetReferences();
|
||||
|
||||
// Invert the order on nodes in facets
|
||||
void InvertFacets();
|
||||
|
||||
public:
|
||||
// Constructor
|
||||
HepPolyhedron(int Nvert=0, int Nface=0)
|
||||
: nvert(Nvert), nface(Nface),
|
||||
pV(Nvert ? new HepPoint3D[Nvert+1] : 0),
|
||||
pF(Nface ? new G4Facet[Nface+1] : 0) {}
|
||||
|
||||
// Copy constructor
|
||||
HepPolyhedron(const HepPolyhedron & from);
|
||||
|
||||
// Destructor
|
||||
virtual ~HepPolyhedron() { delete [] pV; delete [] pF; }
|
||||
|
||||
// Assignment
|
||||
virtual HepPolyhedron & operator=(const HepPolyhedron & from);
|
||||
|
||||
// Get number of vertices
|
||||
int GetNoVertices() const { return nvert; }
|
||||
|
||||
// Get number of facets
|
||||
int GetNoFacets() const { return nface; }
|
||||
|
||||
// Transform the polyhedron
|
||||
HepPolyhedron & Transform(const HepTransform3D & t);
|
||||
|
||||
// Get next vertex index of the quadrilateral
|
||||
HepBoolean GetNextVertexIndex(int & index, int & edgeFlag) const;
|
||||
|
||||
// Get vertex by index
|
||||
HepPoint3D GetVertex(int index) const;
|
||||
|
||||
// Get next vertex + edge visibility of the quadrilateral
|
||||
HepBoolean GetNextVertex(HepPoint3D & vertex, int & edgeFlag) const;
|
||||
|
||||
// Get next vertex + edge visibility + normal of the quadrilateral
|
||||
HepBoolean GetNextVertex(HepPoint3D & vertex, int & edgeFlag,
|
||||
HepNormal3D & normal) const;
|
||||
|
||||
// Get indeces of the next edge with indeces of the faces
|
||||
HepBoolean GetNextEdgeIndeces(int & i1, int & i2, int & edgeFlag,
|
||||
int & iface1, int & iface2) const;
|
||||
|
||||
// Get indeces of the next edge
|
||||
HepBoolean GetNextEdgeIndeces(int & i1, int & i2, int & edgeFlag) const;
|
||||
|
||||
// Get next edge
|
||||
HepBoolean GetNextEdge(HepPoint3D &p1, HepPoint3D &p2, int &edgeFlag) const;
|
||||
|
||||
// Get next edge
|
||||
HepBoolean GetNextEdge(HepPoint3D &p1, HepPoint3D &p2, int &edgeFlag,
|
||||
int &iface1, int &iface2) const;
|
||||
|
||||
// Get face by index
|
||||
void GetFacet(int iFace, int &n, int *iNodes,
|
||||
int *edgeFlags = 0, int *iFaces = 0) const;
|
||||
|
||||
// Get face by index
|
||||
void GetFacet(int iFace, int &n, HepPoint3D *nodes,
|
||||
int *edgeFlags = 0, HepNormal3D *normals = 0) const;
|
||||
|
||||
// Get next face with normals at the nodes
|
||||
HepBoolean GetNextFacet(int &n, HepPoint3D *nodes,
|
||||
int *edgeFlags=0, HepNormal3D *normals=0) const;
|
||||
|
||||
// Get normal of the face given by index
|
||||
HepNormal3D GetNormal(int iFace) const;
|
||||
|
||||
// Get unit normal of the face given by index
|
||||
HepNormal3D GetUnitNormal(int iFace) const;
|
||||
|
||||
// Get normal of the next face
|
||||
HepBoolean GetNextNormal(HepNormal3D &normal) const;
|
||||
|
||||
// Get normal of unit length of the next face
|
||||
HepBoolean GetNextUnitNormal(HepNormal3D &normal) const;
|
||||
|
||||
// Boolean operations
|
||||
HepPolyhedron add(const HepPolyhedron &p) const;
|
||||
HepPolyhedron subtract(const HepPolyhedron &p) const;
|
||||
HepPolyhedron intersect(const HepPolyhedron &p) const;
|
||||
|
||||
// Set number of steps for whole circle
|
||||
static void SetNumberOfRotationSteps(int n);
|
||||
|
||||
// Reset number of steps for whole circle to default value
|
||||
static void ResetNumberOfRotationSteps() {
|
||||
fNumberOfRotationSteps = DEFAULT_NUMBER_OF_STEPS;
|
||||
}
|
||||
};
|
||||
|
||||
class HepPolyhedronTrd2 : public HepPolyhedron {
|
||||
public:
|
||||
HepPolyhedronTrd2(HepDouble Dx1, HepDouble Dx2,
|
||||
HepDouble Dy1, HepDouble Dy2, HepDouble Dz);
|
||||
virtual HepPolyhedron& operator = (const HepPolyhedron& from) {
|
||||
return HepPolyhedron::operator = (from);
|
||||
}
|
||||
};
|
||||
|
||||
class HepPolyhedronTrd1 : public HepPolyhedronTrd2 {
|
||||
public:
|
||||
HepPolyhedronTrd1(HepDouble Dx1, HepDouble Dx2,
|
||||
HepDouble Dy, HepDouble Dz) :
|
||||
HepPolyhedronTrd2(Dx1, Dx2, Dy, Dy, Dz) {}
|
||||
virtual HepPolyhedron& operator = (const HepPolyhedron& from) {
|
||||
return HepPolyhedron::operator = (from);
|
||||
}
|
||||
};
|
||||
|
||||
class HepPolyhedronBox : public HepPolyhedronTrd2 {
|
||||
public:
|
||||
HepPolyhedronBox(HepDouble Dx, HepDouble Dy, HepDouble Dz) :
|
||||
HepPolyhedronTrd2(Dx, Dx, Dy, Dy, Dz) {}
|
||||
virtual HepPolyhedron& operator = (const HepPolyhedron& from) {
|
||||
return HepPolyhedron::operator = (from);
|
||||
}
|
||||
};
|
||||
|
||||
class HepPolyhedronTrap : public HepPolyhedron {
|
||||
public:
|
||||
HepPolyhedronTrap(HepDouble Dz, HepDouble Theta, HepDouble Phi,
|
||||
HepDouble Dy1,
|
||||
HepDouble Dx1, HepDouble Dx2, HepDouble Alp1,
|
||||
HepDouble Dy2,
|
||||
HepDouble Dx3, HepDouble Dx4, HepDouble Alp2);
|
||||
virtual HepPolyhedron& operator = (const HepPolyhedron& from) {
|
||||
return HepPolyhedron::operator = (from);
|
||||
}
|
||||
};
|
||||
|
||||
class HepPolyhedronPara : public HepPolyhedronTrap {
|
||||
public:
|
||||
HepPolyhedronPara(HepDouble Dx, HepDouble Dy, HepDouble Dz,
|
||||
HepDouble Alpha, HepDouble Theta, HepDouble Phi) :
|
||||
HepPolyhedronTrap(Dz, Theta, Phi, Dy, Dx, Dx, Alpha, Dy, Dx, Dx, Alpha) {}
|
||||
virtual HepPolyhedron& operator = (const HepPolyhedron& from) {
|
||||
return HepPolyhedron::operator = (from);
|
||||
}
|
||||
};
|
||||
|
||||
class HepPolyhedronCons : public HepPolyhedron {
|
||||
public:
|
||||
HepPolyhedronCons(HepDouble Rmn1, HepDouble Rmx1,
|
||||
HepDouble Rmn2, HepDouble Rmx2, HepDouble Dz,
|
||||
HepDouble Phi1, HepDouble Dphi);
|
||||
virtual HepPolyhedron& operator = (const HepPolyhedron& from) {
|
||||
return HepPolyhedron::operator = (from);
|
||||
}
|
||||
};
|
||||
|
||||
class HepPolyhedronCone : public HepPolyhedronCons {
|
||||
public:
|
||||
HepPolyhedronCone(HepDouble Rmn1, HepDouble Rmx1,
|
||||
HepDouble Rmn2, HepDouble Rmx2, HepDouble Dz)
|
||||
: HepPolyhedronCons(Rmn1, Rmx1, Rmn2, Rmx2, Dz, 0*deg, 360*deg) {}
|
||||
virtual HepPolyhedron& operator = (const HepPolyhedron& from) {
|
||||
return HepPolyhedron::operator = (from);
|
||||
}
|
||||
};
|
||||
|
||||
class HepPolyhedronTubs : public HepPolyhedronCons {
|
||||
public:
|
||||
HepPolyhedronTubs(HepDouble Rmin, HepDouble Rmax, HepDouble Dz,
|
||||
HepDouble Phi1, HepDouble Dphi)
|
||||
: HepPolyhedronCons(Rmin, Rmax, Rmin, Rmax, Dz, Phi1, Dphi) {}
|
||||
virtual HepPolyhedron& operator = (const HepPolyhedron& from) {
|
||||
return HepPolyhedron::operator = (from);
|
||||
}
|
||||
};
|
||||
|
||||
class HepPolyhedronTube : public HepPolyhedronCons {
|
||||
public:
|
||||
HepPolyhedronTube (HepDouble Rmin, HepDouble Rmax, HepDouble Dz)
|
||||
: HepPolyhedronCons(Rmin, Rmax, Rmin, Rmax, Dz, 0*deg, 360*deg) {}
|
||||
virtual HepPolyhedron& operator = (const HepPolyhedron& from) {
|
||||
return HepPolyhedron::operator = (from);
|
||||
}
|
||||
};
|
||||
|
||||
class HepPolyhedronPgon : public HepPolyhedron {
|
||||
public:
|
||||
HepPolyhedronPgon(HepDouble phi, HepDouble dphi, int npdv, int nz,
|
||||
const HepDouble *z,
|
||||
const HepDouble *rmin,
|
||||
const HepDouble *rmax);
|
||||
virtual HepPolyhedron& operator = (const HepPolyhedron& from) {
|
||||
return HepPolyhedron::operator = (from);
|
||||
}
|
||||
};
|
||||
|
||||
class HepPolyhedronPcon : public HepPolyhedronPgon {
|
||||
public:
|
||||
HepPolyhedronPcon(HepDouble phi, HepDouble dphi, int nz,
|
||||
const HepDouble *z,
|
||||
const HepDouble *rmin,
|
||||
const HepDouble *rmax)
|
||||
: HepPolyhedronPgon(phi, dphi, 0, nz, z, rmin, rmax) {}
|
||||
virtual HepPolyhedron& operator = (const HepPolyhedron& from) {
|
||||
return HepPolyhedron::operator = (from);
|
||||
}
|
||||
};
|
||||
|
||||
class HepPolyhedronSphere : public HepPolyhedron {
|
||||
public:
|
||||
HepPolyhedronSphere(HepDouble rmin, HepDouble rmax,
|
||||
HepDouble phi, HepDouble dphi,
|
||||
HepDouble the, HepDouble dthe);
|
||||
virtual HepPolyhedron& operator = (const HepPolyhedron& from) {
|
||||
return HepPolyhedron::operator = (from);
|
||||
}
|
||||
};
|
||||
|
||||
class HepPolyhedronTorus : public HepPolyhedron {
|
||||
public:
|
||||
HepPolyhedronTorus(HepDouble rmin, HepDouble rmax, HepDouble rtor,
|
||||
HepDouble phi, HepDouble dphi);
|
||||
virtual HepPolyhedron& operator = (const HepPolyhedron& from) {
|
||||
return HepPolyhedron::operator = (from);
|
||||
}
|
||||
};
|
||||
|
||||
#endif /* HEP_POLYHEDRON_HH */
|
||||
Reference in New Issue
Block a user