Public Member Functions | Protected Attributes | List of all members
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...
 
- Public Member Functions inherited from geoalgo::Line
 Line ()
 Default constructor. More...
 
virtual ~Line ()
 Default destructor. More...
 
 Line (const double x1, const double y1, const double z1, const double x2, const double y2, const double z2)
 Alternative ctor (1) More...
 
 Line (const Point_t &pt1, const Point_t &pt2)
 Altenartive ctor (2) More...
 
const Point_tPt1 () const
 Start getter. More...
 
const Point_tPt2 () const
 Direction getter. More...
 
void Pt1 (const double x, const double y, const double z)
 Pt1 setter. More...
 
void Pt2 (const double x, const double y, const double z)
 Pt2 setter. More...
 
template<class T , class U >
 Line (const T &pt1, const U &pt2)
 Alternative ctor using template (3) More...
 
template<class T >
void Pt1 (const T &pt1)
 Pt1 setter template. More...
 
template<class T >
void Pt2 (const T &pt2)
 Pt2 setter template. More...
 

Protected Attributes

double _radius
 Radius of the cylinder. More...
 
GeoAlgo _geoAlgo
 
- Protected Attributes inherited from geoalgo::Line
Point_t _pt1
 First point denoting infinite line. More...
 
Vector_t _pt2
 Second point denoting infinite line. More...
 

Additional Inherited Members

- Protected Member Functions inherited from geoalgo::Line
void check_and_raise (const Point_t &p1, const Point_t &p2) const
 Compatibility check. 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.

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

Default destructor.

Definition at line 39 of file GeoCylinder.h.

39 {};
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 11 of file GeoCylinder.cxx.

14  : Line(x_min, y_min, z_min, x_max, y_max, z_max)
15  , _radius ( radius )
16  {}
double _radius
Radius of the cylinder.
Definition: GeoCylinder.h:59
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)
20  , _radius ( radius )
21  {
22  if(min.size()!=3 || max.size()!=3)
23  throw GeoAlgoException("Cylinder ctor accepts only 3D Point!");
24  }
double _radius
Radius of the cylinder.
Definition: GeoCylinder.h:59
static int max(int a, int b)
T min(sqlite3 *const db, std::string const &table_name, std::string const &column_name)
Definition: statistics.h:55
Line()
Default constructor.
Definition: GeoLine.cxx:6

Member Function Documentation

bool geoalgo::Cylinder::Contain ( const Point_t pt) const

Containment evaluation.

Test if a point is contained within the box

Definition at line 26 of file GeoCylinder.cxx.

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)
37  return false;
38 
39  // revert the axis direction
40  axis = _pt2-_pt1;
41  dirpt = pt-_pt1;
42  angleMin = axis.Angle(dirpt);
43 
44  // if the angle is > 90 -> outside -> return
45  if (angleMin > 0.5*3.14)
46  return false;
47 
48  // if still here, all that is left to verify is
49  // that the point isn't more than a radius
50  // away from the cylinder axis
51  // 1) make a line corresponding to the axis
52  // 2) get the distance between the point and the line
53  double radial_dist_sq = _geoAlgo.SqDist(*this,pt);
54 
55  if (radial_dist_sq > _radius*_radius)
56  return false;
57 
58  return true;
59 
60  }
double SqDist(const Line_t &line, const Point_t &pt) const
Definition: GeoAlgo.h:87
Point_t _pt1
First point denoting infinite line.
Definition: GeoLine.h:61
double _radius
Radius of the cylinder.
Definition: GeoCylinder.h:59
Vector_t _pt2
Second point denoting infinite line.
Definition: GeoLine.h:62
recob::tracking::Vector_t Vector_t
double Angle(const Vector &obj) const
Compute a cross product of two vectors.
Definition: GeoVector.cxx:76
double geoalgo::Cylinder::GetRadius ( )
inline

Getters.

Definition at line 53 of file GeoCylinder.h.

53 { return _radius; }
double _radius
Radius of the cylinder.
Definition: GeoCylinder.h:59
void geoalgo::Cylinder::SetRadius ( double  r)
inline

Setters.

Definition at line 55 of file GeoCylinder.h.

55 { _radius = r; }
double _radius
Radius of the cylinder.
Definition: GeoCylinder.h:59

Member Data Documentation

GeoAlgo geoalgo::Cylinder::_geoAlgo
protected

Definition at line 62 of file GeoCylinder.h.

double geoalgo::Cylinder::_radius
protected

Radius of the cylinder.

Definition at line 59 of file GeoCylinder.h.


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