IMP  2.1.1
The Integrative Modeling Platform
Cone3D.h
Go to the documentation of this file.
1 /**
2  * \file IMP/algebra/Cone3D.h
3  * \brief stores a cone
4  *
5  * Copyright 2007-2013 IMP Inventors. All rights reserved.
6  */
7 
8 #ifndef IMPALGEBRA_CONE_3D_H
9 #define IMPALGEBRA_CONE_3D_H
10 
11 #include "Vector3D.h"
12 #include "Sphere3D.h"
13 #include "SpherePatch3D.h"
14 #include "Plane3D.h"
15 #include "Segment3D.h"
16 #include "GeometricPrimitiveD.h"
19 #include <iostream>
20 #include "constants.h"
21 
22 IMPALGEBRA_BEGIN_NAMESPACE
23 /**
24  In general, a cone is a pyramid with a circular cross section.
25  A right cone is a cone with its vertex above the center of its base.
26  However, when used without qualification, the term "cone" often means
27  "right cone." We have implemented a "right cone".
28  \geometry
29  */
30 class IMPALGEBRAEXPORT Cone3D : public GeometricPrimitiveD<3> {
31  public:
32  Cone3D() {}
33  // A cone with a top at s.get_point(0) and the given base radius
34  Cone3D(const Segment3D &s, double radius);
35  //!Get the vertex of the cone
36  Vector3D get_tip() const { return seg_.get_point(0); }
37  //!Get the direction of the axis of the cone
38  /** This vector points from the tip into the occupied volume.
39  */
40  Vector3D get_direction() const { return seg_.get_direction(); }
41  double get_height() const { return seg_.get_length(); }
42  /** The opening angle of a cone is the vertex angle made by a cross section
43  through the apex and center of the base.*/
44  double get_angle() const { return 2. * std::atan(radius_ / get_height()); }
45  //! get the radius of the base circle
46  double get_radius() const { return radius_; }
47  bool get_contains(const Vector3D &v) const;
48  //! Get the plane supporting the base of the cone
49  /** The cone is on the positive side of the plane.
50  */
51  Plane3D get_base_plane() const;
52  IMP_SHOWABLE_INLINE(Cone3D, out << seg_ << ": " << radius_;);
53 
54  private:
55  Segment3D seg_;
56  double radius_;
57 };
58 
60  Cone3D, cone_3d, IMP_UNUSED(g); IMP_NOT_IMPLEMENTED, IMP_UNUSED(g);
62 IMPALGEBRA_END_NAMESPACE
63 
64 #endif /* IMPALGEBRA_CONE_3D_H */
Basic types used by IMP.
double get_angle() const
Definition: Cone3D.h:44
Simple 3D sphere patch class.
#define IMP_NOT_IMPLEMENTED
Use this to make that the method is not implemented yet.
#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
Vector3D get_tip() const
Get the vertex of the cone.
Definition: Cone3D.h:36
Vector3D get_direction() const
Get the direction of the axis of the cone.
Definition: Cone3D.h:40
Various general useful macros for IMP.
#define IMP_VOLUME_GEOMETRY_METHODS(Name, name, area, volume, bounding_box)
implement the needed namespace methods for a geometry type
double get_radius() const
get the radius of the base circle
Definition: Cone3D.h:46
Various useful constants.
Simple 3D plane class.
Simple 3D vector class.
Various general useful macros for IMP.
Simple 3D sphere class.