Geant4
9.6.p02
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
geant4_9_6_p02
source
geometry
solids
BREPS
include
G4Surface.hh
Go to the documentation of this file.
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$
28
//
29
// ----------------------------------------------------------------------
30
// Class G4Surface
31
//
32
// Class description:
33
//
34
// Base class for a generic surface.
35
36
// Authors: J.Sulkimo, P.Urban.
37
// Revisions by: L.Broglia, G.Cosmo.
38
// ----------------------------------------------------------------------
39
#ifndef __surface_h
40
#define __surface_h 1
41
42
#include "
geomdefs.hh
"
43
#include "
G4CurveVector.hh
"
44
#include "
G4PointRat.hh
"
45
#include "
G4Ray.hh
"
46
#include "
G4BoundingBox3D.hh
"
47
#include "
G4STEPEntity.hh
"
48
#include "
G4SurfaceBoundary.hh
"
49
50
class
G4Surface
:
public
G4STEPEntity
51
{
52
53
public
:
// with description
54
55
G4Surface
();
56
virtual
~G4Surface
();
57
// Constructor & destructor.
58
59
G4int
operator==
(
const
G4Surface
&
s
);
60
// Equality operator.
61
62
virtual
G4String
GetEntityType
()
const
;
63
// Returns type information, needed for STEP output.
64
65
virtual
const
char
*
Name
()
const
;
66
virtual
G4int
MyType
()
const
;
67
// Returns type information, redundant versions...
68
69
void
SetBoundaries
(
G4CurveVector
*);
70
// Sets the boundaries of the surface. The curves in the CurveVector
71
// must be non-intersecting closed curves.
72
73
virtual
G4double
HowNear
(
const
G4Vector3D
&
x
)
const
;
74
// Returns the distance from the point x to the Surface.
75
// The default for a Surface is the distance from the point to the
76
// origin. Overridden by derived classes to take into account boundaries.
77
78
virtual
G4double
ClosestDistanceToPoint
(
const
G4Point3D
& Pt);
79
// Returns the closest distance to point Pt, as for HowNear() above.
80
// This one is used by G4BREPSolid.
81
82
inline
G4Vector3D
GetOrigin
()
const
;
83
inline
G4double
GetDistance
()
const
;
84
inline
void
SetDistance
(
G4double
Dist);
85
inline
G4int
IsActive
()
const
;
86
inline
void
SetActive
(
G4int
act);
87
inline
void
Deactivate
();
88
inline
void
SetSameSense
(
G4int
sameSense0);
89
inline
G4int
GetSameSense
()
const
;
90
inline
G4BoundingBox3D
*
GetBBox
();
91
inline
const
G4Point3D
&
GetClosestHit
()
const
;
92
inline
void
SetNextNode
(
G4Surface
*);
93
inline
G4Surface
*
GetNextNode
();
94
// Get/Set methods for surface's attributes.
95
96
virtual
void
Reset
();
97
// Resets basic attributes.
98
99
virtual
G4int
Intersect
(
const
G4Ray
&);
100
// Should return the intersection with a ray. Cannot be called from
101
// G4Surface base class. Overridden by subclasses.
102
103
virtual
G4Vector3D
Normal
(
const
G4Vector3D
&
p
)
const
;
104
// Returns the Normal unit vector to a Surface at the point p on
105
// (or nearly on) the Surface. The default is not well defined,
106
// so return ( 0, 0, 0 ). Overridden by subclasses.
107
108
virtual
void
CalcBBox
();
109
// Calculates the bounds for a bounding box to the surface.
110
// The bounding box is used for a preliminary check of intersection.
111
112
public
:
// without description
113
114
static
void
Project
(
G4double
& Coord,
const
G4Point3D
& Pt,
115
const
G4Plane
& Pl);
116
// Utility function returning the projection (Coord) of a point Pt
117
// on a plane Pl.
118
119
virtual
G4double
GetUHit
()
const
;
120
virtual
G4double
GetVHit
()
const
;
121
// Overriden by BSplineSurface.
122
// uhit and vhit are never set.
123
124
virtual
G4Point3D
Evaluation
(
const
G4Ray
& G4Rayref);
125
virtual
G4int
Evaluate
(
register
const
G4Ray
& Rayref);
126
// For NURBS, there is a two pass intersection algorithm.
127
// Sometimes, the result of the cheap one tells us
128
// that execution of the expensive one is not necessary.
129
// Evaluation (Evaluate?) is one of them. Better names wanted!
130
131
virtual
void
Project
();
132
// Used by BREPSolid. Thus it's probably needed.
133
134
virtual
void
CalcNormal
();
135
// Used only in G4FPlane. Should be private to that class?
136
137
virtual
G4int
IsConvex
()
const
;
138
// Only in G4FPlane. BREPSolid::IsConvex uses it.
139
// But who uses BREPSolid::IsConvex? Thus: probably not needed.
140
// However, knowing if the surface is convex could be used for
141
// optimization.
142
143
virtual
G4int
GetConvex
()
const
;
144
// Only in G4FPlane, but G4BREPSolid uses them.
145
146
virtual
G4int
GetNumberOfPoints
()
const
;
147
virtual
const
G4Point3D
&
GetPoint
(
G4int
Count)
const
;
148
// ???
149
150
virtual
G4Ray
*
Norm
();
151
virtual
G4Vector3D
SurfaceNormal
(
const
G4Point3D
& Pt)
const
= 0;
152
// There is Normal as well -- so what do these do?
153
154
/*
155
virtual G4double distanceAlongRay( G4int which_way, const G4Ray* ry,
156
G4Vector3D& p ) const;
157
// Returns distance along a Ray (straight line with G4ThreeVec) to leave
158
// or enter a Surface. The input variable which_way should be set to +1
159
// to indicate leaving a Surface, -1 to indicate entering a Surface.
160
// p is the point of intersection of the Ray with the Surface.
161
// This is a default function which just gives the distance
162
// between the origin of the Ray and the origin of the Surface.
163
// Since a generic Surface doesn't have a well-defined Normal, no
164
// further checks are Done. It must be overwritten by derived classes.
165
166
virtual G4double G4Surface::distanceAlongHelix( G4int which_way,
167
const Helix* hx,
168
G4ThreeVec& p ) const;
169
// Returns the distance along a Helix to leave or enter a Surface.
170
// The input variable which_way should be set to +1 to indicate
171
// leaving a Surface, -1 to indicate entering a Surface.
172
// p is the point of intersection of the Helix with the Surface.
173
// This is a default function which just gives the distance
174
// between the origin of the Helix and the origin of the Surface.
175
// Since a generic Surface doesn't have a well-defined Normal, no
176
// further checks are Done. It must be overwritten by derived classes.
177
*/
178
179
protected
:
180
181
virtual
void
InitBounded
();
182
183
protected
:
184
185
G4BoundingBox3D
*
bbox
;
186
G4Point3D
closest_hit
;
187
G4Surface
*
next
;
188
189
G4SurfaceBoundary
surfaceBoundary
;
190
// The boundaries of the surface.
191
192
G4double
kCarTolerance
,
kAngTolerance
;
193
194
G4int
Intersected
;
195
// BSplineSurface and FPlane sets it, no one gets it.
196
197
G4Vector3D
origin
;
198
// Origin of Surface.
199
200
G4int
Type
;
201
G4int
AdvancedFace
;
202
G4int
active
;
203
G4double
distance
;
204
G4double
uhit
,
vhit
;
205
// Generic attributes...
206
207
G4int
sameSense
;
208
// by L. Broglia
209
210
private
:
211
212
G4Surface
(
const
G4Surface
&);
213
G4Surface
& operator=(
const
G4Surface
&);
214
// Private copy constructor and assignment operator.
215
216
};
217
218
#include "G4Surface.icc"
219
220
#endif
Generated on Sat May 25 2013 14:33:13 for Geant4 by
1.8.4