37 #ifndef EGS_CIRCLE_PERPENDICULAR_
38 #define EGS_CIRCLE_PERPENDICULAR_
46 #ifdef BUILD_CIRCLE_PERPENDICULAR_DLL
47 #define EGS_CIRCLE_PERPENDICULAR_EXPORT __declspec(dllexport)
49 #define EGS_CIRCLE_PERPENDICULAR_EXPORT __declspec(dllimport)
51 #define EGS_CIRCLE_PERPENDICULAR_LOCAL
55 #ifdef HAVE_VISIBILITY
56 #define EGS_CIRCLE_PERPENDICULAR_EXPORT __attribute__ ((visibility ("default")))
57 #define EGS_CIRCLE_PERPENDICULAR_LOCAL __attribute__ ((visibility ("hidden")))
59 #define EGS_CIRCLE_PERPENDICULAR_EXPORT
60 #define EGS_CIRCLE_PERPENDICULAR_LOCAL
123 A = M_PI*dr*(dr + 2*ro);
127 EGS_Float r = ro + dr*sqrt(rndm->
getUniform());
128 EGS_Float cphi, sphi;
130 return EGS_Vector(xo + r*cphi, yo + r*sphi, 0);
144 EGS_Float d2i = 1/u.length2(), di = sqrt(d2i);
149 EGS_Float angleBetween = std::acos(u * perpToCircle / (perpToCircle.length() * u.length()));
154 if ((fabs(u.
z) - perpToCircle.
z) <
epsilon) {
155 rotateAbout = perpToCircle;
158 rotateAbout = u.times(perpToCircle);
171 d2i = 1/u.length2(), di = sqrt(d2i);
173 wt = A*u.length()*d2i;
181 EGS_Float xo, yo, ro, dr;
A circle shape perpendicular to source particles.
A class for vector rotations.
A class representing 3D vectors.
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 ...
EGS_CirclePerpendicularShape(EGS_Float Xo, EGS_Float Yo, EGS_Float R, EGS_Float R_i=0, const string &Name="", EGS_ObjectFactory *f=0)
Conctruct a circle with midpoint given by Xo and Yo, radius R and innder radius R_i.
virtual EGS_Vector getPoint(EGS_RandomGenerator *rndm)
Sample and return a random 3D vector.
Base random number generator class. All random number generators should be derived from this class...
EGS_RandomGenerator class header file.
EGS_BaseShape and shape classes header file.
static EGS_RotationMatrix rotV(EGS_Float phi, const EGS_Vector &v)
Returns a rotation by the angle phi around the axis defined by the vector v.
Attempts to fix broken math header files.
EGS_Float getUniform()
Returns a random number uniformly distributed between zero (inclusive) and 1 (exclusive).
const EGS_Float epsilon
The epsilon constant for floating point comparisons.
void getPointSourceDirection(const EGS_Vector &Xo, EGS_RandomGenerator *rndm, EGS_Vector &u, EGS_Float &wt)
Get a random direction given a source position Xo.