EGSnrc C++ class library  Report PIRS-898 (2021)
Iwan Kawrakow, Ernesto Mainegra-Hing, Frederic Tessier, Reid Townson and Blake Walters
egs_shapes.h
Go to the documentation of this file.
1 /*
2 ###############################################################################
3 #
4 # EGSnrc egs++ shapes headers
5 # Copyright (C) 2015 National Research Council Canada
6 #
7 # This file is part of EGSnrc.
8 #
9 # EGSnrc is free software: you can redistribute it and/or modify it under
10 # the terms of the GNU Affero General Public License as published by the
11 # Free Software Foundation, either version 3 of the License, or (at your
12 # option) any later version.
13 #
14 # EGSnrc is distributed in the hope that it will be useful, but WITHOUT ANY
15 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
16 # FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for
17 # more details.
18 #
19 # You should have received a copy of the GNU Affero General Public License
20 # along with EGSnrc. If not, see <http://www.gnu.org/licenses/>.
21 #
22 ###############################################################################
23 #
24 # Author: Iwan Kawrakow, 2005
25 #
26 # Contributors: Frederic Tessier
27 # Marc Chamberland
28 # Reid Townson
29 #
30 ###############################################################################
31 */
32 
33 
39 #ifndef EGS_SHAPES_
40 #define EGS_SHAPES_
41 
42 #include "egs_vector.h"
43 #include "egs_transformations.h"
44 #include "egs_rndm.h"
45 #include "egs_object_factory.h"
46 #include "egs_input_struct.h"
47 
48 #include <string>
49 using std::string;
50 
51 class EGS_Input;
52 
53 inline void setShapeInputs(shared_ptr<EGS_BlockInput> shapePtr) {
54  auto libPtr = shapePtr->addSingleInput("library", false, "The type of shape, loaded by shared library in egs++/dso.");
55  auto typePtr = shapePtr->addSingleInput("type", false, "The type of shape - this input includes only a small set of simple shapes. For more options, use the 'library' input instead.", {"point", "box", "sphere", "cylinder"});
56 
57  // Only one of "library" or "type" are allowed
58  libPtr->addDependency(typePtr, "", true);
59  typePtr->addDependency(libPtr, "", true);
60 
61  // Point
62  shapePtr->addSingleInput("position", true, "The x, y, z position that the source will emit particles from.")->addDependency(typePtr, "point");
63 
64  // Box
65  shapePtr->addSingleInput("box size", true, "The side lengths of the box, in cm. Enter 1 number for a cube, or 3 numbers to denote the x, y, and z side lengths.")->addDependency(typePtr, "box");
66 
67  // Sphere
68  auto radiusPtr = shapePtr->addSingleInput("radius", true, "The radius of the sphere or cylinder, in cm.");
69  radiusPtr->addDependency(typePtr, "sphere");
70  auto midPtr = shapePtr->addSingleInput("midpoint", false, "The x, y and z coordinates of the midpoint of the sphere or cylinder, in cm. Defaults to 0, 0, 0.");
71  midPtr->addDependency(typePtr, "sphere");
72 
73  // Cylinder
74  radiusPtr->addDependency(typePtr, "cylinder");
75  midPtr->addDependency(typePtr, "cylinder");
76  shapePtr->addSingleInput("height", true, "The height of the cylinder, in cm.")->addDependency(typePtr, "cylinder");
77  shapePtr->addSingleInput("phi range", false, "The minimum and maximum phi values, in degrees. This allows you restrict the cylinder to a shape like a slice of pie!")->addDependency(typePtr, "cylinder");
78  shapePtr->addSingleInput("axis", true, "A unit vector that defines the axis of the cylinder.")->addDependency(typePtr, "cylinder");
79 
80  addTransformationBlock(shapePtr);
81 }
82 
146 
147 public:
148 
150  EGS_BaseShape(const string &Name="",EGS_ObjectFactory *f=0) :
151  EGS_Object(Name,f), T(0) {
152  otype = "base_shape";
153  };
155  virtual ~EGS_BaseShape() {
156  if (T) {
157  delete T;
158  }
159  };
160 
168  if (T) {
169  return (*T)*getPoint(rndm);
170  }
171  else {
172  return getPoint(rndm);
173  }
174  };
175 
183  (void)rndm;
184  egsFatal("You need to implement the getPoint function in your "
185  "derived class\n");
186  return EGS_Vector();
187  };
188 
197  void setTransformation(EGS_Input *inp);
198 
204  if (T) {
205  delete T;
206  }
207  T = new EGS_AffineTransform(*t);
208  };
209 
213  return T;
214  };
215 
223  static EGS_BaseShape *createShape(EGS_Input *inp);
224 
231  static EGS_BaseShape *getShape(const string &Name);
232 
238  virtual bool supportsDirectionMethod() const {
239  return false;
240  };
241 
242  /* getNextShapePosition is the equivalent of getNextParticle but for a shape object. Its goal is to determine the next state of the geometry, either by synchronizing itself to the
243  * source time parameter, or by sampling it's own time parameter and updating itself accordingly if the source has provided no time index.
244  *
245  *This function has a non-empty implementation in 2 cases.
246  *1) it is re implemented in any composite shape, where it will call getNextShapePosition on all of its components
247  *2) it is re implemented in the dynamic shape class. This is where the code will find the current (non static) state of the shape. */
248  virtual void getNextShapePosition(EGS_RandomGenerator *rndm) {
249  (void)rndm;
250  };
251 
264  virtual void getPointSourceDirection(const EGS_Vector &xo,
265  EGS_RandomGenerator *rndm, EGS_Vector &u, EGS_Float &wt) {
266  (void)xo;
267  (void)rndm;
268  (void)u;
269  (void)wt;
270  egsFatal("getPointSourceDirection: you have to implement this "
271  "method for the %s shape if you want to use it\n",otype.c_str());
272  };
273 
280  virtual EGS_Float area() const {
281  return 1;
282  };
283 
286  virtual void updatePosition(EGS_Float time) {
287  (void)time;
288  };
289 
290 protected:
291 
293 
294 };
295 
307 
308 public:
309 
311  EGS_SurfaceShape(const string &Name="",EGS_ObjectFactory *f=0) :
312  EGS_BaseShape(Name,f), A(1) {};
318  bool supportsDirectionMethod() const {
319  return true;
320  };
322  EGS_Float area() const {
323  return A;
324  };
330  EGS_RandomGenerator *rndm, EGS_Vector &u, EGS_Float &wt) {
331  EGS_Vector xo = T ? Xo*(*T) : Xo;
332  EGS_Vector x = getPoint(rndm);
333  u = x - xo;
334  EGS_Float d2i = 1/u.length2(), di = sqrt(d2i);
335  u *= di;
336  wt = A*fabs(u.z)*d2i;
337  if (T) {
338  T->rotate(u);
339  }
340  };
341 
342 protected:
343 
349  EGS_Float A;
350 
351 };
352 
369 
370 public:
371 
374  const string &Name="",EGS_ObjectFactory *f=0) :
375  EGS_BaseShape(Name,f), xo(Xo) {
376  otype = "point";
377  };
378  ~EGS_PointShape() { };
381  return xo;
382  };
387 
388 protected:
389 
391 
392 };
393 
411 
412 protected:
413 
414  EGS_Float ax, ay, az;
415 
416 public:
417 
419  EGS_BoxShape(const string &Name="",EGS_ObjectFactory *f=0) :
420  EGS_BaseShape(Name,f), ax(1), ay(1), az(1) {
421  otype="box";
422  };
424  EGS_BoxShape(EGS_Float A, const EGS_AffineTransform *t = 0,
425  const string &Name="",EGS_ObjectFactory *f=0) :
426  EGS_BaseShape(Name,f), ax(A), ay(A), az(A) {
427  if (t) {
428  T = new EGS_AffineTransform(*t);
429  }
430  otype="box";
431  };
433  EGS_BoxShape(EGS_Float Ax, EGS_Float Ay, EGS_Float Az,
434  const EGS_AffineTransform *t = 0,
435  const string &Name="",EGS_ObjectFactory *f=0) :
436  EGS_BaseShape(Name,f), ax(Ax), ay(Ay), az(Az) {
437  if (t) {
438  T = new EGS_AffineTransform(*t);
439  }
440  otype="box";
441  };
444 
447  EGS_Vector v(ax*(rndm->getUniform()-0.5),
448  ay*(rndm->getUniform()-0.5),
449  az*(rndm->getUniform()-0.5));
450  return v;
451  };
452 
457 
461  bool supportsDirectionMethod() const {
462  return true;
463  };
464 
470  EGS_RandomGenerator *rndm, EGS_Vector &u, EGS_Float &wt) {
471  EGS_Vector xo = T ? Xo*(*T) : Xo;
472  EGS_Float eta = rndm->getUniform()*area();
473  if (eta < 2*ax*ay) {
474  u.x = ax*(rndm->getUniform()-0.5);
475  u.y = ay*(rndm->getUniform()-0.5);
476  if (eta < ax*ay) {
477  u.z = az/2;
478  wt = u.z - xo.z;
479  }
480  else {
481  u.z = -az/2;
482  wt = xo.z - u.z;
483  }
484  }
485  else if (eta < 2*(ax*ay + ax*az)) {
486  u.x = ax*(rndm->getUniform()-0.5);
487  u.z = az*(rndm->getUniform()-0.5);
488  if (eta < 2*ax*ay + ax*az) {
489  u.y = ay/2;
490  wt = u.y - xo.y;
491  }
492  else {
493  u.y = -ay/2;
494  wt = xo.y - u.y;
495  }
496  }
497  else {
498  eta -= 2*(ax*ay + ax*az);
499  u.y = ay*(rndm->getUniform()-0.5);
500  u.z = az*(rndm->getUniform()-0.5);
501  if (eta < ay*az) {
502  u.x = ax/2;
503  wt = u.x - xo.x;
504  }
505  else {
506  u.x = -ax/2;
507  wt = xo.x - u.x;
508  }
509  }
510  u -= xo;
511  EGS_Float d2 = u.length2(), d = sqrt(d2);
512  u *= (1/d);
513  wt *= (area()/(d2*d));
514  if (T) {
515  T->rotate(u);
516  }
517  };
519  EGS_Float area() const {
520  return 2*(ax*ay + ax*az + ay*az);
521  };
522 
523 };
524 
543 
544 protected:
545 
546  EGS_Float R;
548 
549 public:
550 
552  EGS_SphereShape(const string &Name="",EGS_ObjectFactory *f=0) :
553  EGS_BaseShape(Name,f), R(1), xo() {
554  otype="sphere";
555  };
557  EGS_SphereShape(EGS_Float r, const EGS_Vector &Xo = EGS_Vector(0,0,0),
558  const string &Name="",EGS_ObjectFactory *f=0) :
559  EGS_BaseShape(Name,f), R(r), xo(Xo) {
560  otype = "sphere";
561  };
564 
567  EGS_Float r = rndm->getUniform(), r1 = rndm->getUniform(),
568  r2 = rndm->getUniform();
569  if (r1 > r) {
570  r = r1;
571  }
572  if (r2 > r) {
573  r = r2;
574  }
575  EGS_Float cost = 2*rndm->getUniform()-1;
576  EGS_Float sint = sqrt(1-cost*cost);
577  r1 = R*r*sint;
578  EGS_Float cphi, sphi;
579  rndm->getAzimuth(cphi,sphi);
580  return xo + EGS_Vector(r1*cphi,r1*sphi,R*r*cost);
581  };
582 
587 
591  bool supportsDirectionMethod() const {
592  return true;
593  };
594 
600  EGS_RandomGenerator *rndm, EGS_Vector &u, EGS_Float &wt) {
601  EGS_Vector xo = T ? Xo*(*T) : Xo;
602  EGS_Float cost = 2*rndm->getUniform()-1;
603  EGS_Float sint = 1-cost*cost;
604  EGS_Vector x;
605  if (sint > epsilon) {
606  EGS_Float cphi, sphi;
607  rndm->getAzimuth(cphi,sphi);
608  sint = R*sqrt(sint);
609  x.x = sint*cphi;
610  x.y = sint*sphi;
611  x.z = R*cost;
612  }
613  else {
614  x.z = R*cost;
615  }
616  u = (x + this->xo) - xo;
617  EGS_Float di = 1/u.length();
618  u *= di;
619  wt = u*x*4*M_PI*R*di*di;
620  };
622  EGS_Float area() const {
623  return 4*M_PI*R*R;
624  };
625 };
626 
651 
652 protected:
653 
654  EGS_Float R;
655  EGS_Float h;
658  EGS_Float phi_min;
659  EGS_Float phi_max;
660  bool has_phi;
661 
663  inline void getPointInCircle(EGS_RandomGenerator *rndm, EGS_Float &x,
664  EGS_Float &y) {
665  if (!has_phi) {
666  do {
667  x = 2*rndm->getUniform()-1;
668  y = 2*rndm->getUniform()-1;
669  }
670  while (x*x + y*y > 1);
671  x *= R;
672  y *= R;
673  }
674  else {
675  EGS_Float r = R*sqrt(rndm->getUniform());
676  EGS_Float eta = rndm->getUniform();
677  EGS_Float phi = phi_min*(1-eta) + phi_max*eta;
678  x = r*cos(phi);
679  y = r*sin(phi);
680  }
681  };
682 
683 
684 public:
685 
689  EGS_CylinderShape(const string &Name="",EGS_ObjectFactory *f=0) :
690  EGS_BaseShape(), R(1), h(1), xo(), a(0,0,1),
691  phi_min(0), phi_max(2*M_PI), has_phi(false) {
692  (void)Name;
693  (void)f;
694  otype="cylinder";
695  };
696  EGS_CylinderShape(EGS_Float r, EGS_Float H,
697  const EGS_Vector &Xo = EGS_Vector(0,0,0),
698  const EGS_Vector &A = EGS_Vector(0,0,1),
699  const string &Name="",EGS_ObjectFactory *f=0) :
700  EGS_BaseShape(Name,f), R(r), h(H), xo(Xo), a(A),
701  phi_min(0), phi_max(2*M_PI), has_phi(false) {
702  EGS_RotationMatrix rmat(a);
703  if (xo.length2() > epsilon || !rmat.isI()) {
704  T = new EGS_AffineTransform(rmat.inverse(),xo);
705  }
706  otype="cylinder";
707  };
711  EGS_CylinderShape(EGS_Float r, EGS_Float H, const EGS_AffineTransform *t,
712  const string &Name="",EGS_ObjectFactory *f=0) :
713  EGS_BaseShape(Name,f), R(r), h(H),
714  phi_min(0), phi_max(2*M_PI), has_phi(false) {
715  if (t) {
716  T = new EGS_AffineTransform(*t);
717  }
718  otype="cylinder";
719  };
722 
724  void setPhiRange(EGS_Float Phi_min, EGS_Float Phi_max) {
725  if (Phi_min < Phi_max) {
726  phi_min = Phi_min;
727  phi_max = Phi_max;
728  }
729  else {
730  phi_min = Phi_max;
731  phi_max = Phi_min;
732  }
733  if (phi_max - phi_min < 1.99999*M_PI) {
734  has_phi = true;
735  }
736  else {
737  has_phi = false;
738  }
739  };
740 
745  EGS_Float x,y;
746  getPointInCircle(rndm,x,y);
747  EGS_Float z = h*(rndm->getUniform()-0.5);
748  return EGS_Vector(x,y,z);
749  };
750 
755 
757  EGS_Float getRadius() const {
758  return R;
759  };
761  EGS_Float getHeight() const {
762  return h;
763  };
764 
768  bool supportsDirectionMethod() const {
769  return true;
770  };
771 
777  EGS_RandomGenerator *rndm, EGS_Vector &u, EGS_Float &wt) {
778  EGS_Vector xo = T ? Xo*(*T) : Xo;
779  EGS_Float eta = rndm->getUniform()*(R+h);
780  EGS_Vector x; // point on cylinder with respect to midpoint
781  EGS_Vector n; // normal to cylinder at point x
782  if (eta < R) {
783  getPointInCircle(rndm,x.x,x.y);
784  if (2*eta < R) {
785  x.z = h/2; // top face: normal is up
786  n.z = 1;
787  }
788  else {
789  x.z = -h/2; // bottom face: normal is down
790  n.z = -1;
791  }
792  }
793  else {
794  EGS_Float cphi,sphi;
795  rndm->getAzimuth(cphi,sphi);
796  x.x = R*cphi;
797  x.y = R*sphi;
798  x.z = h*(rndm->getUniform()-0.5);
799  n.x = x.x;
800  n.y = x.y; // side face: normal is (x,y)
801  }
802  u = (x+this->xo) - xo; // direction vector from origin to cylinder point
803  EGS_Float d2 = u.length2(), d = sqrt(d2);
804  u *= (1/d); // normalize direction vectors
805  n.normalize(); // normalize normal
806  wt = u*n*area()/d2;
807  if (T) {
808  T->rotate(u);
809  }
810  };
812  EGS_Float area() const {
813  return 2*M_PI*R*(R+h);
814  };
815 };
816 
817 #endif
A class providing affine transformations.
Base shape class. All shapes in the EGSnrc C++ class library are derived from EGS_BaseShape.
Definition: egs_shapes.h:145
void setTransformation(EGS_AffineTransform *t)
Set the transformation attached to this shape.
Definition: egs_shapes.h:203
virtual void getPointSourceDirection(const EGS_Vector &xo, EGS_RandomGenerator *rndm, EGS_Vector &u, EGS_Float &wt)
Definition: egs_shapes.h:264
virtual EGS_Float area() const
Definition: egs_shapes.h:280
EGS_AffineTransform * T
The affine transformation attached to the shape.
Definition: egs_shapes.h:288
EGS_BaseShape(const string &Name="", EGS_ObjectFactory *f=0)
Construct a shape named Name.
Definition: egs_shapes.h:150
virtual ~EGS_BaseShape()
Destructor. Deletes T if it is not null.
Definition: egs_shapes.h:155
virtual EGS_Vector getPoint(EGS_RandomGenerator *rndm)
Sample and return a random 3D vector.
Definition: egs_shapes.h:182
virtual void updatePosition(EGS_Float time)
Update the position of the shape if it is in motion.
Definition: egs_shapes.h:286
const EGS_AffineTransform * getTransform() const
Get a pointer to the affine transformation attached to this shape.
Definition: egs_shapes.h:212
virtual EGS_Vector getRandomPoint(EGS_RandomGenerator *rndm)
Returns a random 3D vector.
Definition: egs_shapes.h:167
virtual bool supportsDirectionMethod() const
Definition: egs_shapes.h:238
A box shape.
Definition: egs_shapes.h:410
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 the on the box surface.
Definition: egs_shapes.h:469
EGS_Float az
The box size.
Definition: egs_shapes.h:414
EGS_Vector getPoint(EGS_RandomGenerator *rndm)
Returns a point uniformly distributed within the box.
Definition: egs_shapes.h:446
EGS_BoxShape(const string &Name="", EGS_ObjectFactory *f=0)
Create a box shape with unit size.
Definition: egs_shapes.h:419
EGS_BoxShape(EGS_Float A, const EGS_AffineTransform *t=0, const string &Name="", EGS_ObjectFactory *f=0)
Create a cube with size A.
Definition: egs_shapes.h:424
EGS_BoxShape(EGS_Float Ax, EGS_Float Ay, EGS_Float Az, const EGS_AffineTransform *t=0, const string &Name="", EGS_ObjectFactory *f=0)
Create a box shape with size Ax,Ay,Az.
Definition: egs_shapes.h:433
bool supportsDirectionMethod() const
Returns true. (It is easy to implement the getPointSourceDirection() method for a box....
Definition: egs_shapes.h:461
EGS_Float area() const
Returns the box surface area.
Definition: egs_shapes.h:519
~EGS_BoxShape()
Destructor. Does nothing.
Definition: egs_shapes.h:443
A cylinder shape.
Definition: egs_shapes.h:650
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.
Definition: egs_shapes.h:776
bool supportsDirectionMethod() const
Returns true. (It is easy to implement the getPointSourceDirection() method for a cylinder....
Definition: egs_shapes.h:768
EGS_Float getHeight() const
Definition: egs_shapes.h:761
void getPointInCircle(EGS_RandomGenerator *rndm, EGS_Float &x, EGS_Float &y)
Get a point uniformly distributed within a circle.
Definition: egs_shapes.h:663
void setPhiRange(EGS_Float Phi_min, EGS_Float Phi_max)
Definition: egs_shapes.h:724
EGS_Float h
Cylinder height.
Definition: egs_shapes.h:655
EGS_Float getRadius() const
Definition: egs_shapes.h:757
EGS_CylinderShape(EGS_Float r, EGS_Float H, const EGS_AffineTransform *t, const string &Name="", EGS_ObjectFactory *f=0)
Definition: egs_shapes.h:711
EGS_Vector a
Cylinder axis.
Definition: egs_shapes.h:657
EGS_CylinderShape(const string &Name="", EGS_ObjectFactory *f=0)
Definition: egs_shapes.h:689
bool has_phi
True, if azimuthal range restricted.
Definition: egs_shapes.h:660
EGS_Vector getPoint(EGS_RandomGenerator *rndm)
Samples and returns a point uniformly distributed within the cylinder.
Definition: egs_shapes.h:744
EGS_Float R
Cylinder radius.
Definition: egs_shapes.h:654
EGS_Vector xo
midpoint
Definition: egs_shapes.h:656
EGS_Float area() const
Returns the cylinder surface area.
Definition: egs_shapes.h:812
A class for storing information in a tree-like structure of key-value pairs. This class is used throu...
Definition: egs_input.h:182
An object factory.
Base egspp object.
virtual EGS_Object * createObject(EGS_Input *inp)
Create an object from the infromation pointed to by inp.
A point shape. This is the simplest shape possible: it simply always returns the same point.
Definition: egs_shapes.h:368
EGS_Vector xo
The point position.
Definition: egs_shapes.h:390
EGS_Vector getPoint(EGS_RandomGenerator *)
Returns a fixed point.
Definition: egs_shapes.h:380
EGS_PointShape(const EGS_Vector &Xo=EGS_Vector(), const string &Name="", EGS_ObjectFactory *f=0)
Construct a point shape located at Xo.
Definition: egs_shapes.h:373
Base random number generator class. All random number generators should be derived from this class.
Definition: egs_rndm.h:90
void getAzimuth(EGS_Float &cphi, EGS_Float &sphi)
Sets cphi and sphi to the cosine and sine of a random angle uniformely distributed between 0 and .
Definition: egs_rndm.h:161
EGS_Float getUniform()
Returns a random number uniformly distributed between zero (inclusive) and 1 (exclusive).
Definition: egs_rndm.h:126
A class for vector rotations.
A sphere shape.
Definition: egs_shapes.h:542
EGS_SphereShape(const string &Name="", EGS_ObjectFactory *f=0)
Construct a sphere of unit radius about the origin.
Definition: egs_shapes.h:552
EGS_SphereShape(EGS_Float r, const EGS_Vector &Xo=EGS_Vector(0, 0, 0), const string &Name="", EGS_ObjectFactory *f=0)
Construct a sphere of radius r with midpoint Xo.
Definition: egs_shapes.h:557
bool supportsDirectionMethod() const
Returns true. (It is easy to implement the getPointSourceDirection() method for a sphere....
Definition: egs_shapes.h:591
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 sphere surface.
Definition: egs_shapes.h:599
EGS_Float area() const
Returns the sphere surface area.
Definition: egs_shapes.h:622
EGS_Vector getPoint(EGS_RandomGenerator *rndm)
Returns a random point within the sphere.
Definition: egs_shapes.h:566
EGS_Float R
The sphere radius.
Definition: egs_shapes.h:546
EGS_Vector xo
The sphere midpoint.
Definition: egs_shapes.h:547
A surface shape.
Definition: egs_shapes.h:306
EGS_SurfaceShape(const string &Name="", EGS_ObjectFactory *f=0)
Construct a surface shape named Name.
Definition: egs_shapes.h:311
~EGS_SurfaceShape()
Destructor. Does nothing.
Definition: egs_shapes.h:314
void getPointSourceDirection(const EGS_Vector &Xo, EGS_RandomGenerator *rndm, EGS_Vector &u, EGS_Float &wt)
Get a random direction given a source position Xo.
Definition: egs_shapes.h:329
EGS_Float area() const
Returns the area of this surface shape.
Definition: egs_shapes.h:322
bool supportsDirectionMethod() const
Always returns true. Shapes derived from this class must implement the getPoint() method to return po...
Definition: egs_shapes.h:318
A class representing 3D vectors.
Definition: egs_vector.h:57
EGS_Float y
y-component
Definition: egs_vector.h:62
EGS_Float z
z-component
Definition: egs_vector.h:63
EGS_Float x
x-component
Definition: egs_vector.h:61
The input struct header file.
#define EGS_EXPORT
Export symbols from the egspp library.
Definition: egs_libconfig.h:90
EGS_Object and EGS_ObjectFactory class header file.
EGS_RandomGenerator class header file.
EGS_AffineTransform and EGS_RotationMatrix class header file.
EGS_Vector methods for the manipulation of 3D vectors in cartesian co-ordinates.
EGS_InfoFunction EGS_EXPORT egsFatal
Always use this function for reporting fatal errors.
const EGS_Float epsilon
The epsilon constant for floating point comparisons.
Definition: egs_functions.h:62