IMP  2.0.0
The Integrative Modeling Platform
Cylinder3D.h
Go to the documentation of this file.
1 /**
2  * \file IMP/algebra/Cylinder3D.h
3  * \brief stores a cylinder
4  *
5  * Copyright 2007-2013 IMP Inventors. All rights reserved.
6  */
7 
8 #ifndef IMPALGEBRA_CYLINDER_3D_H
9 #define IMPALGEBRA_CYLINDER_3D_H
10 
11 #include "Vector3D.h"
12 #include "Rotation3D.h"
13 #include "Transformation3D.h"
14 #include "Segment3D.h"
15 #include "GeometricPrimitiveD.h"
17 #include <iostream>
18 #include "constants.h"
19 
20 
21 IMPALGEBRA_BEGIN_NAMESPACE
22 /** It does what is says.
23 
24  \geometry
25 */
26 class IMPALGEBRAEXPORT Cylinder3D: public GeometricPrimitiveD<3> {
27  public:
28  Cylinder3D() {}
29  Cylinder3D(const Segment3D &s, double radius);
30  double get_radius() const {return radius_;}
31  const Segment3D& get_segment() const {
32  return s_;
33  }
34 
35  /** Returns a point on the surface of the cylinder,
36  specified by its location relative to the cylinder axis
37  and its rotation angle about the axis
38 
39  @param relative_height a number in the range [0..1] that specifies
40  the point location relative to the cylinder axis
41  such that 0 specifies the cylinder bottom and
42  1 specifies its top
43  @param angle angle in radians about the cylinder axis, with 0 set to an
44  arbitrary but consistent direction
45  */
46  const Vector3D get_surface_point_at
47  (double relative_height,
48  double angle);
49 
50  /** Returns a point inside the cylinder,
51  specified by its location relative to the cylinder axis,
52  its relative radius and its rotation angle about the axis
53 
54  @param relative_height a number in the range [0..1] that specifies
55  the point location relative to the cylinder axis
56  such that 0 specifies the cylinder bottom and
57  1 specifies its top
58  @param relative_radius a number in the range [0..1] that specifies
59  the distance of the point from the cylinder axis
60  relative to the cylinder radius, 0 being on the
61  axis itself, and 1 being on the cylinder surface
62  @param angle angle in radians about the cylinder axis, with 0 set to an
63  arbitrary but consistent direction
64  */
65  const Vector3D get_inner_point_at
66  (double relative_height,
67  double relative_radius,
68  double angle) const;
69 
70 
72  {out << s_ << ": " << radius_;});
73 
74  private:
75  Segment3D s_;
76  double radius_;
77 };
78 
80  return 2.0*PI*g.get_radius()
81  * g.get_segment().get_length()
82  + 2.0*PI *get_squared(g.get_radius()),
83  return PI *get_squared(g.get_radius())
84  * g.get_segment().get_length(),
86 
87 IMPALGEBRA_END_NAMESPACE
88 
89 #endif /* IMPALGEBRA_CYLINDER_3D_H */