IMP  2.1.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 IMPALGEBRA_BEGIN_NAMESPACE
21 /** It does what is says.
22 
23  \geometry
24 */
25 class IMPALGEBRAEXPORT Cylinder3D : public GeometricPrimitiveD<3> {
26  public:
27  Cylinder3D() {}
28  Cylinder3D(const Segment3D& s, double radius);
29  double get_radius() const { return radius_; }
30  const Segment3D& get_segment() const { return s_; }
31 
32  /** Returns a point on the surface of the cylinder,
33  specified by its location relative to the cylinder axis
34  and its rotation angle about the axis
35 
36  @param relative_height a number in the range [0..1] that specifies
37  the point location relative to the cylinder axis
38  such that 0 specifies the cylinder bottom and
39  1 specifies its top
40  @param angle angle in radians about the cylinder axis, with 0 set to an
41  arbitrary but consistent direction
42  */
43  const Vector3D get_surface_point_at(double relative_height, double angle);
44 
45  /** Returns a point inside the cylinder,
46  specified by its location relative to the cylinder axis,
47  its relative radius and its rotation angle about the axis
48 
49  @param relative_height a number in the range [0..1] that specifies
50  the point location relative to the cylinder axis
51  such that 0 specifies the cylinder bottom and
52  1 specifies its top
53  @param relative_radius a number in the range [0..1] that specifies
54  the distance of the point from the cylinder axis
55  relative to the cylinder radius, 0 being on the
56  axis itself, and 1 being on the cylinder surface
57  @param angle angle in radians about the cylinder axis, with 0 set to an
58  arbitrary but consistent direction
59  */
60  const Vector3D get_inner_point_at(double relative_height,
61  double relative_radius, double angle) const;
62 
63  IMP_SHOWABLE_INLINE(Cylinder3D, { out << s_ << ": " << radius_; });
64 
65  private:
66  Segment3D s_;
67  double radius_;
68 };
69 
71  Cylinder3D, cylinder_3d,
72  return 2.0 * PI * g.get_radius() * g.get_segment().get_length() +
73  2.0 * PI * get_squared(g.get_radius()),
74  return PI * get_squared(g.get_radius()) * g.get_segment().get_length(),
75  IMP_UNUSED(g);
77 
78 IMPALGEBRA_END_NAMESPACE
79 
80 #endif /* IMPALGEBRA_CYLINDER_3D_H */
Basic types used by IMP.
#define IMP_NOT_IMPLEMENTED
Use this to make that the method is not implemented yet.
static const double PI
the constant pi
#define IMP_UNUSED(variable)
#define IMP_SHOWABLE_INLINE(Name, how_to_show)
Declare the methods needed by an object that can be printed.
simple implementation of segments in 3D
#define IMP_VOLUME_GEOMETRY_METHODS(Name, name, area, volume, bounding_box)
implement the needed namespace methods for a geometry type
Various useful constants.
Simple 3D rotation class.
Simple 3D transformation class.
Simple 3D vector class.
Various general useful macros for IMP.
DensityMap * get_segment(DensityMap *map_to_segment, int nx_start, int nx_end, int ny_start, int ny_end, int nz_start, int nz_end)
Get a segment of the map according to xyz indexes.