Geant4  10.02.p03
G4ArrowModel Class Reference

#include <G4ArrowModel.hh>

Inheritance diagram for G4ArrowModel:
Collaboration diagram for G4ArrowModel:

Public Member Functions

 G4ArrowModel (G4double x1, G4double y1, G4double z1, G4double x2, G4double y2, G4double z2, G4double width, const G4Colour &colour, const G4String &description="")
 
virtual ~G4ArrowModel ()
 
virtual void DescribeYourselfTo (G4VGraphicsScene &)
 
- Public Member Functions inherited from G4VModel
 G4VModel (const G4Transform3D &modelTransformation=G4Transform3D(), const G4ModelingParameters *=0)
 
virtual ~G4VModel ()
 
const G4ModelingParametersGetModelingParameters () const
 
const G4StringGetType () const
 
virtual G4String GetCurrentDescription () const
 
virtual G4String GetCurrentTag () const
 
const G4VisExtentGetExtent () const
 
const G4StringGetGlobalDescription () const
 
const G4StringGetGlobalTag () const
 
const G4Transform3DGetTransformation () const
 
void SetModelingParameters (const G4ModelingParameters *)
 
void SetExtent (const G4VisExtent &)
 
void SetType (const G4String &)
 
void SetGlobalDescription (const G4String &)
 
void SetGlobalTag (const G4String &)
 
void SetTransformation (const G4Transform3D &)
 
virtual G4bool Validate (G4bool warn=true)
 

Private Member Functions

 G4ArrowModel (const G4ArrowModel &)
 
G4ArrowModeloperator= (const G4ArrowModel &)
 

Private Attributes

G4PolyhedronfpShaftPolyhedron
 
G4PolyhedronfpHeadPolyhedron
 

Additional Inherited Members

- Protected Attributes inherited from G4VModel
G4String fType
 
G4String fGlobalTag
 
G4String fGlobalDescription
 
G4VisExtent fExtent
 
G4Transform3D fTransform
 
const G4ModelingParametersfpMP
 

Detailed Description

Definition at line 48 of file G4ArrowModel.hh.

Constructor & Destructor Documentation

◆ G4ArrowModel() [1/2]

G4ArrowModel::G4ArrowModel ( G4double  x1,
G4double  y1,
G4double  z1,
G4double  x2,
G4double  y2,
G4double  z2,
G4double  width,
const G4Colour colour,
const G4String description = "" 
)

Definition at line 52 of file G4ArrowModel.cc.

56 {
57  fType = "G4ArrowModel";
58  fGlobalTag = fType;
59  fGlobalDescription = fType + ": " + description;
61  (std::min(x1,x2),
62  std::max(x1,x2),
63  std::min(y1,y2),
64  std::max(y1,y2),
65  std::min(z1,z2),
66  std::max(z1,z2));
67 
68  // Make a cylinder slightly shorter than the arrow length so that it
69  // doesn't stick out of the head.
70  const G4double shaftLength = std::sqrt
71  (std::pow(x2-x1,2)+std::pow(y2-y1,2)+std::pow(z2-z1,2));
72  G4double shaftRadius = width/2.;
73  // Limit the radius
74  if (shaftRadius > shaftLength/100.) shaftRadius = shaftLength/100.;
75  const G4double halfShaftLength = shaftLength/2.;
76  const G4double halfReduction = 4.*shaftRadius;
77  const G4double halfLength = halfShaftLength-halfReduction;
78  G4Tubs shaft("shaft",0.,shaftRadius,halfLength,0.,twopi);
79  fpShaftPolyhedron = shaft.CreatePolyhedron();
80  // Move it a little so that the tail is at z = -halfShaftLength.
81  fpShaftPolyhedron->Transform(G4Translate3D(0,0,-halfReduction));
82 
83  // Locate the head at +halfShaftLength.
84  const G4int numRZ = 3;
85  G4double r[] = {0,4,0};
86  G4double z[] = {0,-6,-4};
87  for (G4int i = 0; i < numRZ; i++) {
88  r[i] *= 2.*shaftRadius;
89  z[i] = halfShaftLength + z[i] * 2.*shaftRadius;
90  }
91  G4GenericPolycone head("head",0,twopi,numRZ,r,z);
92  fpHeadPolyhedron = head.CreatePolyhedron();
93 
94  // Transform to position
95  const G4Vector3D arrowDirection = G4Vector3D(x2-x1,y2-y1,z2-z1).unit();
96  const G4double theta = arrowDirection.theta();
97  const G4double phi = arrowDirection.phi();
98  const G4Point3D arrowCentre(0.5*(x1+x2),0.5*(y1+y2),0.5*(z1+z2));
99  const G4Transform3D tr =
100  G4Translate3D(arrowCentre) * G4RotateZ3D(phi) * G4RotateY3D(theta);
103 
104  G4VisAttributes va;
105  va.SetColour(colour);
106  va.SetForceSolid(true);
109 }
Double_t y2[nxs]
void SetColour(const G4Colour &)
Double_t y1[nxs]
HepGeom::RotateY3D G4RotateY3D
Double_t x2[nxs]
G4String fType
Definition: G4VModel.hh:108
Definition: G4Tubs.hh:85
#define width
HepGeom::Vector3D< G4double > G4Vector3D
Definition: G4Vector3D.hh:35
void SetForceSolid(G4bool)
HepPolyhedron & Transform(const G4Transform3D &t)
int G4int
Definition: G4Types.hh:78
HepGeom::RotateZ3D G4RotateZ3D
G4String fGlobalTag
Definition: G4VModel.hh:109
static const double twopi
Definition: G4SIunits.hh:75
Double_t x1[nxs]
G4String fGlobalDescription
Definition: G4VModel.hh:110
G4Polyhedron * fpShaftPolyhedron
Definition: G4ArrowModel.hh:67
void SetVisAttributes(const G4VisAttributes *)
Definition: G4Visible.cc:80
HepGeom::Translate3D G4Translate3D
G4VisExtent fExtent
Definition: G4VModel.hh:111
double G4double
Definition: G4Types.hh:76
BasicVector3D< T > unit() const
G4Polyhedron * fpHeadPolyhedron
Definition: G4ArrowModel.hh:68
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ~G4ArrowModel()

G4ArrowModel::~G4ArrowModel ( )
virtual

Definition at line 45 of file G4ArrowModel.cc.

46 {
47  delete fpHeadPolyhedron;
48  delete fpShaftPolyhedron;
49 }
G4Polyhedron * fpShaftPolyhedron
Definition: G4ArrowModel.hh:67
G4Polyhedron * fpHeadPolyhedron
Definition: G4ArrowModel.hh:68
Here is the call graph for this function:

◆ G4ArrowModel() [2/2]

G4ArrowModel::G4ArrowModel ( const G4ArrowModel )
private

Member Function Documentation

◆ DescribeYourselfTo()

void G4ArrowModel::DescribeYourselfTo ( G4VGraphicsScene sceneHandler)
virtual

Implements G4VModel.

Definition at line 111 of file G4ArrowModel.cc.

112 {
113  sceneHandler.BeginPrimitives();
114  sceneHandler.AddPrimitive(*fpShaftPolyhedron);
115  sceneHandler.AddPrimitive(*fpHeadPolyhedron);
116  sceneHandler.EndPrimitives();
117 }
virtual void BeginPrimitives(const G4Transform3D &objectTransformation=G4Transform3D())=0
virtual void AddPrimitive(const G4Polyline &)=0
G4Polyhedron * fpShaftPolyhedron
Definition: G4ArrowModel.hh:67
virtual void EndPrimitives()=0
G4Polyhedron * fpHeadPolyhedron
Definition: G4ArrowModel.hh:68
Here is the call graph for this function:
Here is the caller graph for this function:

◆ operator=()

G4ArrowModel& G4ArrowModel::operator= ( const G4ArrowModel )
private

Member Data Documentation

◆ fpHeadPolyhedron

G4Polyhedron* G4ArrowModel::fpHeadPolyhedron
private

Definition at line 68 of file G4ArrowModel.hh.

◆ fpShaftPolyhedron

G4Polyhedron* G4ArrowModel::fpShaftPolyhedron
private

Definition at line 67 of file G4ArrowModel.hh.


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