LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
geoalgo::Cylinder Class Reference

Representation of a 3D Cylinder volume. A Cylinder object inherits from a geoalgo::Line. More...

#include "GeoCylinder.h"

Inheritance diagram for geoalgo::Cylinder:
geoalgo::Line

Public Member Functions

 Cylinder ()
 Default constructor. More...
 
virtual ~Cylinder ()
 Default destructor. More...
 
 Cylinder (const double x_min, const double y_min, const double z_min, const double x_max, const double y_max, const double z_max, const double radius)
 Alternative ctor (0) More...
 
 Cylinder (const Point_t &min, const Vector_t &max, const double radius)
 Altenartive ctor (1) More...
 
bool Contain (const Point_t &pt) const
 Containment evaluation. More...
 
double GetRadius ()
 Getters. More...
 
void SetRadius (double r)
 Setters. More...
 
const Point_tPt1 () const
 Start getter. More...
 
void Pt1 (const double x, const double y, const double z)
 Pt1 setter. More...
 
template<class T >
void Pt1 (const T &pt1)
 Pt1 setter template. More...
 
const Point_tPt2 () const
 Direction getter. More...
 
void Pt2 (const double x, const double y, const double z)
 Pt2 setter. More...
 
template<class T >
void Pt2 (const T &pt2)
 Pt2 setter template. More...
 

Protected Member Functions

void check_and_raise (const Point_t &p1, const Point_t &p2) const
 Compatibility check. More...
 

Protected Attributes

double _radius
 Radius of the cylinder. More...
 
GeoAlgo _geoAlgo
 
Point_t _pt1
 First point denoting infinite line. More...
 
Vector_t _pt2
 Second point denoting infinite line. More...
 

Detailed Description

Representation of a 3D Cylinder volume. A Cylinder object inherits from a geoalgo::Line.

Remarks
input: 2 points, which define the line representing the central axis of the cylinder a radius, defining the radius of the cylinder

Definition at line 31 of file GeoCylinder.h.

Constructor & Destructor Documentation

geoalgo::Cylinder::Cylinder ( )

Default constructor.

Definition at line 6 of file GeoCylinder.cxx.

Referenced by ~Cylinder().

6 : Line(), _radius(0.) {}
double _radius
Radius of the cylinder.
Definition: GeoCylinder.h:61
Line()
Default constructor.
Definition: GeoLine.cxx:6
virtual geoalgo::Cylinder::~Cylinder ( )
inlinevirtual

Default destructor.

Definition at line 38 of file GeoCylinder.h.

References Contain(), Cylinder(), pt, radius, x_max, and x_min.

38 {};
geoalgo::Cylinder::Cylinder ( const double  x_min,
const double  y_min,
const double  z_min,
const double  x_max,
const double  y_max,
const double  z_max,
const double  radius 
)

Alternative ctor (0)

Definition at line 8 of file GeoCylinder.cxx.

15  : Line(x_min, y_min, z_min, x_max, y_max, z_max), _radius(radius)
16  {}
double x_min
Definition: berger.C:15
double _radius
Radius of the cylinder.
Definition: GeoCylinder.h:61
Float_t radius
Definition: plot.C:23
double x_max
Definition: berger.C:16
Line()
Default constructor.
Definition: GeoLine.cxx:6
geoalgo::Cylinder::Cylinder ( const Point_t min,
const Vector_t max,
const double  radius 
)

Altenartive ctor (1)

Definition at line 18 of file GeoCylinder.cxx.

19  : Line(min, max), _radius(radius)
20  {
21  if (min.size() != 3 || max.size() != 3)
22  throw GeoAlgoException("Cylinder ctor accepts only 3D Point!");
23  }
double _radius
Radius of the cylinder.
Definition: GeoCylinder.h:61
Float_t radius
Definition: plot.C:23
Line()
Default constructor.
Definition: GeoLine.cxx:6

Member Function Documentation

void geoalgo::Line::check_and_raise ( const Point_t p1,
const Point_t p2 
) const
protectedinherited

Compatibility check.

Definition at line 49 of file GeoLine.cxx.

Referenced by geoalgo::DirectedLine::DirectedLine(), geoalgo::Line::Line(), geoalgo::Line::Pt1(), geoalgo::Line::Pt2(), and geoalgo::Line::~Line().

50  {
51  if (p1.size() != 3)
52  throw GeoAlgoException("<<check_and_raise>> Pt1 is not 3 dimensional point!");
53  if (p2.size() != 3)
54  throw GeoAlgoException("<<check_and_raise>> Pt2 is not 3 dimensional point!");
55  if (p1 == p2)
56  throw GeoAlgoException("<<check_and_raise>> Two identical points not allowed for Line ctor!");
57  }
bool geoalgo::Cylinder::Contain ( const Point_t pt) const

Containment evaluation.

Test if a point is contained within the box

Definition at line 25 of file GeoCylinder.cxx.

References _geoAlgo, geoalgo::Line::_pt1, geoalgo::Line::_pt2, _radius, geoalgo::Vector::Angle(), and geoalgo::GeoAlgo::SqDist().

Referenced by ~Cylinder().

26  {
27 
28  // get a vector that defines the axis of the cylinder
29  Vector_t axis = _pt1 - _pt2;
30  Vector_t dirpt = pt - _pt2;
31 
32  // angle of point w.r.t. the axis
33  double angleMin = axis.Angle(dirpt);
34 
35  // if the angle is > 90 -> outside -> return
36  if (angleMin > 0.5 * 3.14) return false;
37 
38  // revert the axis direction
39  axis = _pt2 - _pt1;
40  dirpt = pt - _pt1;
41  angleMin = axis.Angle(dirpt);
42 
43  // if the angle is > 90 -> outside -> return
44  if (angleMin > 0.5 * 3.14) return false;
45 
46  // if still here, all that is left to verify is
47  // that the point isn't more than a radius
48  // away from the cylinder axis
49  // 1) make a line corresponding to the axis
50  // 2) get the distance between the point and the line
51  double radial_dist_sq = _geoAlgo.SqDist(*this, pt);
52 
53  if (radial_dist_sq > _radius * _radius) return false;
54 
55  return true;
56  }
double SqDist(const Line_t &line, const Point_t &pt) const
Definition: GeoAlgo.h:98
Point_t _pt1
First point denoting infinite line.
Definition: GeoLine.h:63
double _radius
Radius of the cylinder.
Definition: GeoCylinder.h:61
TMarker * pt
Definition: egs.C:25
Vector_t _pt2
Second point denoting infinite line.
Definition: GeoLine.h:64
recob::tracking::Vector_t Vector_t
double Angle(const Vector &obj) const
Compute a cross product of two vectors.
Definition: GeoVector.cxx:101
double geoalgo::Cylinder::GetRadius ( )
inline

Getters.

Definition at line 56 of file GeoCylinder.h.

References _radius.

56 { return _radius; }
double _radius
Radius of the cylinder.
Definition: GeoCylinder.h:61
const Point_t & geoalgo::Line::Pt1 ( ) const
inherited
void geoalgo::Line::Pt1 ( const double  x,
const double  y,
const double  z 
)
inherited

Pt1 setter.

Definition at line 33 of file GeoLine.cxx.

References geoalgo::Line::_pt1, geoalgo::Line::_pt2, geoalgo::Line::check_and_raise(), x, y, and z.

34  {
35  _pt1[0] = x;
36  _pt1[1] = y;
37  _pt1[2] = z;
39  }
Float_t x
Definition: compare.C:6
Float_t y
Definition: compare.C:6
Double_t z
Definition: plot.C:276
Point_t _pt1
First point denoting infinite line.
Definition: GeoLine.h:63
Vector_t _pt2
Second point denoting infinite line.
Definition: GeoLine.h:64
void check_and_raise(const Point_t &p1, const Point_t &p2) const
Compatibility check.
Definition: GeoLine.cxx:49
template<class T >
void geoalgo::Line::Pt1 ( const T &  pt1)
inlineinherited

Pt1 setter template.

Definition at line 77 of file GeoLine.h.

References geoalgo::Line::check_and_raise().

78  {
79  _pt1 = Point_t(pt1);
81  }
Point_t _pt1
First point denoting infinite line.
Definition: GeoLine.h:63
Vector Point_t
Definition: GeoVector.h:204
Vector_t _pt2
Second point denoting infinite line.
Definition: GeoLine.h:64
TText * pt1
Definition: plot.C:61
void check_and_raise(const Point_t &p1, const Point_t &p2) const
Compatibility check.
Definition: GeoLine.cxx:49
const Point_t & geoalgo::Line::Pt2 ( ) const
inherited

Direction getter.

Definition at line 28 of file GeoLine.cxx.

References geoalgo::Line::_pt2.

Referenced by geoalgo::GeoAlgo::_ClosestPt_(), geoalgo::GeoAlgo::_commonOrigin_(), geoalgo::GeoAlgo::_SqDist_(), and geoalgo::Line::~Line().

29  {
30  return _pt2;
31  }
Vector_t _pt2
Second point denoting infinite line.
Definition: GeoLine.h:64
void geoalgo::Line::Pt2 ( const double  x,
const double  y,
const double  z 
)
inherited

Pt2 setter.

Definition at line 41 of file GeoLine.cxx.

References geoalgo::Line::_pt1, geoalgo::Line::_pt2, geoalgo::Line::check_and_raise(), x, y, and z.

42  {
43  _pt2[0] = x;
44  _pt2[1] = y;
45  _pt2[2] = z;
47  }
Float_t x
Definition: compare.C:6
Float_t y
Definition: compare.C:6
Double_t z
Definition: plot.C:276
Point_t _pt1
First point denoting infinite line.
Definition: GeoLine.h:63
Vector_t _pt2
Second point denoting infinite line.
Definition: GeoLine.h:64
void check_and_raise(const Point_t &p1, const Point_t &p2) const
Compatibility check.
Definition: GeoLine.cxx:49
template<class T >
void geoalgo::Line::Pt2 ( const T &  pt2)
inlineinherited

Pt2 setter template.

Definition at line 85 of file GeoLine.h.

References geoalgo::Line::check_and_raise().

86  {
87  _pt2 = Vector_t(pt2);
89  }
Point_t _pt1
First point denoting infinite line.
Definition: GeoLine.h:63
TText * pt2
Definition: plot.C:64
Vector_t _pt2
Second point denoting infinite line.
Definition: GeoLine.h:64
Vector Vector_t
Point has same feature as Vector.
Definition: GeoVector.h:203
void check_and_raise(const Point_t &p1, const Point_t &p2) const
Compatibility check.
Definition: GeoLine.cxx:49
void geoalgo::Cylinder::SetRadius ( double  r)
inline

Setters.

Definition at line 58 of file GeoCylinder.h.

References _radius, and r.

58 { _radius = r; }
TRandom r
Definition: spectrum.C:23
double _radius
Radius of the cylinder.
Definition: GeoCylinder.h:61

Member Data Documentation

GeoAlgo geoalgo::Cylinder::_geoAlgo
protected

Definition at line 64 of file GeoCylinder.h.

Referenced by Contain().

Point_t geoalgo::Line::_pt1
protectedinherited
Vector_t geoalgo::Line::_pt2
protectedinherited

Second point denoting infinite line.

Definition at line 64 of file GeoLine.h.

Referenced by Contain(), geoalgo::DirectedLine::Dir(), geoalgo::DirectedLine::DirectedLine(), geoalgo::Line::Line(), geoalgo::Line::Pt1(), and geoalgo::Line::Pt2().

double geoalgo::Cylinder::_radius
protected

Radius of the cylinder.

Definition at line 61 of file GeoCylinder.h.

Referenced by Contain(), GetRadius(), and SetRadius().


The documentation for this class was generated from the following files: