EGSnrc C++ class library
Report PIRS-898 (2021)
Iwan Kawrakow, Ernesto Mainegra-Hing, Frederic Tessier, Reid Townson and Blake Walters
|
A cylinder shape. More...
#include <egs_shapes.h>
Public Member Functions | |
EGS_CylinderShape (const string &Name="", EGS_ObjectFactory *f=0) | |
EGS_CylinderShape (EGS_Float r, EGS_Float H, const EGS_Vector &Xo=EGS_Vector(0, 0, 0), const EGS_Vector &A=EGS_Vector(0, 0, 1), const string &Name="", EGS_ObjectFactory *f=0) | |
EGS_CylinderShape (EGS_Float r, EGS_Float H, const EGS_AffineTransform *t, const string &Name="", EGS_ObjectFactory *f=0) | |
~EGS_CylinderShape () | |
void | setPhiRange (EGS_Float Phi_min, EGS_Float Phi_max) |
EGS_Vector | getPoint (EGS_RandomGenerator *rndm) |
Samples and returns a point uniformly distributed within the cylinder. | |
EGS_Object * | createObject (EGS_Input *) |
EGS_Float | getRadius () const |
EGS_Float | getHeight () const |
bool | supportsDirectionMethod () const |
Returns true . (It is easy to implement the getPointSourceDirection() method for a cylinder.) | |
void | getPointSourceDirection (const EGS_Vector &Xo, EGS_RandomGenerator *rndm, EGS_Vector &u, EGS_Float &wt) |
Sets the direction u by picking a random point uniformly on the cylinder surface. More... | |
EGS_Float | area () const |
Returns the cylinder surface area. | |
Public Member Functions inherited from EGS_BaseShape | |
EGS_BaseShape (const string &Name="", EGS_ObjectFactory *f=0) | |
Construct a shape named Name. | |
virtual | ~EGS_BaseShape () |
Destructor. Deletes T if it is not null . | |
virtual EGS_Vector | getRandomPoint (EGS_RandomGenerator *rndm) |
Returns a random 3D vector. More... | |
void | setTransformation (EGS_Input *inp) |
Set the transformation attached to this shape. More... | |
void | setTransformation (EGS_AffineTransform *t) |
Set the transformation attached to this shape. More... | |
const EGS_AffineTransform * | getTransform () const |
Get a pointer to the affine transformation attached to this shape. | |
Public Member Functions inherited from EGS_Object | |
EGS_Object (const string &Name="", EGS_ObjectFactory *f=0) | |
Create an EGS_Object named Name belonging to the object factory f. More... | |
EGS_Object (EGS_Input *inp, EGS_ObjectFactory *f=0) | |
Create an EGS_Object from the information pointed to by inp that belongs to object factory f. More... | |
const string & | getObjectName () const |
Get the object name. | |
void | setObjectName (const string &Name) |
Set the object name to Name. | |
const string & | getObjectType () const |
Get the object type. | |
void | setName (EGS_Input *inp) |
Set the name of the object from the information provided by inp. More... | |
int | ref () |
Increase the reference count to this object. | |
int | deref () |
Decrease the reference count to this object. | |
void | setFactory (EGS_ObjectFactory *f) |
Set the factory to which the object belongs. More... | |
Protected Member Functions | |
void | getPointInCircle (EGS_RandomGenerator *rndm, EGS_Float &x, EGS_Float &y) |
Get a point uniformly distributed within a circle. | |
Protected Attributes | |
EGS_Float | R |
Cylinder radius. | |
EGS_Float | h |
Cylinder height. | |
EGS_Vector | xo |
midpoint | |
EGS_Vector | a |
Cylinder axis. | |
EGS_Float | phi_min |
EGS_Float | phi_max |
bool | has_phi |
True, if azimuthal range restricted. | |
Protected Attributes inherited from EGS_BaseShape | |
EGS_AffineTransform * | T |
The affine transformation attached to the shape. | |
Protected Attributes inherited from EGS_Object | |
string | name |
The object name. | |
string | otype |
The object type. | |
int | nref |
Number of references to the object. | |
EGS_ObjectFactory * | factory |
The factory this object belongs to. | |
Additional Inherited Members | |
Static Public Member Functions inherited from EGS_BaseShape | |
static EGS_BaseShape * | createShape (EGS_Input *inp) |
Create a shape from the information pointed to by inp. More... | |
static EGS_BaseShape * | getShape (const string &Name) |
Get a pointer to the shape named Name. More... | |
Static Public Member Functions inherited from EGS_Object | |
static string | getUniqueName (const EGS_Object *o=0) |
Create and return a unique object name. More... | |
static void | deleteObject (EGS_Object *o) |
Delete an object. More... | |
A cylinder shape.
Samples random points within a cylinder or on the cylinder surfcace. Specified in the input file via
:start shape: type = cylinder radius = the cylinder radius height = the cylinder height midpoint = Ox, Oy, Oz (optional) axis = ax, ay, az (optional) :stop shape:
If the optional midpoint
and axis
inputs are missing, the cylinder is centered about the origin and has its axis along the z-axis.
Definition at line 596 of file egs_shapes.h.
EGS_CylinderShape::EGS_CylinderShape | ( | const string & | Name = "" , |
EGS_ObjectFactory * | f = 0 |
||
) |
Construct a cylinder shape with unit radius and height centered about the origin with an axis along the z-axis.
Definition at line 635 of file egs_shapes.h.
EGS_CylinderShape::EGS_CylinderShape | ( | EGS_Float | r, |
EGS_Float | H, | ||
const EGS_AffineTransform * | t, | ||
const string & | Name = "" , |
||
EGS_ObjectFactory * | f = 0 |
||
) |
Construct a cylinder shape with radius r and height H centered about the origin with axis along the z-axis.
Definition at line 655 of file egs_shapes.h.
EGS_CylinderShape::~EGS_CylinderShape | ( | ) |
Destructor. Does nothing.
Definition at line 665 of file egs_shapes.h.
void EGS_CylinderShape::setPhiRange | ( | EGS_Float | Phi_min, |
EGS_Float | Phi_max | ||
) |
Set a restriction on the azimuthal angular range
Definition at line 668 of file egs_shapes.h.
Referenced by createObject().
|
virtual |
Creates and returns a pointer to a cylinder shape from the information pointed to by inp, or null
if the information is insufficient.
Reimplemented from EGS_Object.
Definition at line 154 of file egs_shapes.cpp.
References egsWarning, EGS_Input::getInput(), EGS_AffineTransform::getTransformation(), EGS_Object::setName(), and setPhiRange().
EGS_Float EGS_CylinderShape::getRadius | ( | ) | const |
Get the cylinder radius
Definition at line 701 of file egs_shapes.h.
EGS_Float EGS_CylinderShape::getHeight | ( | ) | const |
Get the cylinder height
Definition at line 705 of file egs_shapes.h.
|
virtual |
Sets the direction u by picking a random point uniformly on the cylinder surface.
Reimplemented from EGS_BaseShape.
Definition at line 720 of file egs_shapes.h.
References EGS_BaseShape::area(), EGS_RandomGenerator::getAzimuth(), EGS_RandomGenerator::getUniform(), EGS_Vector::x, EGS_Vector::y, and EGS_Vector::z.