1 #ifndef _CachedDirectInjectorOG_TankGeometry_h_
2 #define _CachedDirectInjectorOG_TankGeometry_h_
6 #include <utl/GeometryUtilities.h>
7 #include <utl/Particle.h>
16 namespace CachedDirectInjectorOG {
20 TankGeometry(
const double bottom,
const double top,
const double radius,
22 fBottomPlane(
Point(0, 0, bottom, cs),
Vector(0,0,1, cs)),
24 fRadius2(
Sqr(radius)),
34 const Line particleLine(particlePoint, particleDirection);
38 if ((where - fTopPlane.GetAnchor()).GetMag2() < fRadius2)
41 const double ax = particleDirection.
GetX(fCS);
42 const double ay = particleDirection.
GetY(fCS);
43 const double px = particlePoint.
GetX(fCS);
44 const double py = particlePoint.
GetY(fCS);
46 const double b = 2*(ax*px + ay*py);
47 const double c =
Sqr(px) +
Sqr(py) - fRadius2;
48 const double disc =
Sqr(b) - 4*a*
c;
50 const double ta = 2*
a;
51 const double s0 = -b/ta;
53 const double delta =
sqrt(disc) / ta;
55 const double s = s0 - delta;
57 where = particleLine.Propagate(s);
64 if ((where - fBottomPlane.GetAnchor()).GetMag2() < fRadius2)
constexpr T Sqr(const T &x)
Describes a particle for Simulation.
TankGeometry(const double bottom, const double top, const double radius, const CoordinateSystemPtr cs)
double Distance(const Line &line1, const Line &line2)
Line Intersection(const Plane &p1, const Plane &p2)
boost::shared_ptr< const CoordinateTransformer > CoordinateSystemPtr
Shared pointer for coordinate systems.
Class describing a Plane object.
double GetX(const CoordinateSystemPtr &coordinateSystem) const
double GetY(const CoordinateSystemPtr &coordinateSystem) const
struct particle_info particle[80]
const Point & GetPosition() const
Position of the particle.
const Vector & GetDirection() const
Unit vector giving particle direction.
const CoordinateSystemPtr fCS