IMP  2.4.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-2015 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 
22 //! Represent a cylinder in 3D.
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 { return s_; }
32 
33  /** Returns a point on the surface of the cylinder,
34  specified by its location relative to the cylinder axis
35  and its rotation angle about the axis
36 
37  @param relative_height a number in the range [0..1] that specifies
38  the point location relative to the cylinder axis
39  such that 0 specifies the cylinder bottom and
40  1 specifies its top
41  @param angle angle in radians about the cylinder axis, with 0 set to an
42  arbitrary but consistent direction
43  */
44  const Vector3D get_surface_point_at(double relative_height, double angle);
45 
46  /** Returns a point inside the cylinder,
47  specified by its location relative to the cylinder axis,
48  its relative radius and its rotation angle about the axis
49 
50  @param relative_height a number in the range [0..1] that specifies
51  the point location relative to the cylinder axis
52  such that 0 specifies the cylinder bottom and
53  1 specifies its top
54  @param relative_radius a number in the range [0..1] that specifies
55  the distance of the point from the cylinder axis
56  relative to the cylinder radius, 0 being on the
57  axis itself, and 1 being on the cylinder surface
58  @param angle angle in radians about the cylinder axis, with 0 set to an
59  arbitrary but consistent direction
60  */
61  const Vector3D get_inner_point_at(double relative_height,
62  double relative_radius, double angle) const;
63 
64  IMP_SHOWABLE_INLINE(Cylinder3D, { out << s_ << ": " << radius_; });
65 
66  private:
67  Segment3D s_;
68  double radius_;
69 };
70 
72  return 2.0 * PI * g.get_radius() *
73  g.get_segment().get_length() +
74  2.0 * PI * get_squared(g.get_radius()),
75  return PI * get_squared(g.get_radius()) *
76  g.get_segment().get_length(),
77  IMP_UNUSED(g);
79 
80 IMPALGEBRA_END_NAMESPACE
81 
82 #endif /* IMPALGEBRA_CYLINDER_3D_H */
Basic types used by IMP.
#define IMP_SHOWABLE_INLINE(Name, how_to_show)
Declare the methods needed by an object that can be printed.
static const double PI
the constant pi
Represent a cylinder in 3D.
Definition: Cylinder3D.h:26
Simple implementation of segments in 3D.
Base class for geometric types.
#define IMP_UNUSED(variable)
#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 implementation of segments in 3D.
Definition: Segment3D.h:24
VectorD< 3 > Vector3D
Definition: VectorD.h:395
Simple 3D vector class.
#define IMP_NOT_IMPLEMENTED
Use this to mark that the method is not implemented yet.
Definition: check_macros.h:83
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.
Various general useful macros for IMP.