IMP logo
IMP Reference Guide  2.6.2
The Integrative Modeling Platform
Ellipsoid3D.h
Go to the documentation of this file.
1 /**
2  * \file IMP/algebra/Ellipsoid3D.h \brief Simple 3D ellipsoid class.
3  *
4  * Copyright 2007-2016 IMP Inventors. All rights reserved.
5  *
6  */
7 
8 #ifndef IMPALGEBRA_ELLIPSOID_3D_H
9 #define IMPALGEBRA_ELLIPSOID_3D_H
10 
11 #include <IMP/algebra/algebra_config.h>
12 #include "constants.h"
13 #include "BoundingBoxD.h"
14 #include "Transformation3D.h"
15 #include "ReferenceFrame3D.h"
16 #include "GeometricPrimitiveD.h"
17 
18 IMPALGEBRA_BEGIN_NAMESPACE
19 
20 //! Represent an ellipsoid in 3D.
21 /** \geometry */
22 class IMPALGEBRAEXPORT Ellipsoid3D : public GeometricPrimitiveD<3> {
23  public:
24  Ellipsoid3D() {}
25  Ellipsoid3D(const ReferenceFrame3D &rf, const algebra::Vector3D &radii)
26  : rf_(rf), radii_(radii) {}
27  Ellipsoid3D(const Vector3D &center, double radius_x, double radius_y,
28  double radius_z, const Rotation3D &rot);
29  const Vector3D &get_radii() const { return radii_; }
30  const ReferenceFrame3D &get_reference_frame() const { return rf_; }
31  IMP_SHOWABLE_INLINE(Ellipsoid3D, out << rf_ << ": " << radii_);
32 
33  private:
34  ReferenceFrame3D rf_;
35  Vector3D radii_;
36 };
37 
40  return 4.0 / 3.0 * PI * g.get_radii()[0] *
41  g.get_radii()[1] * g.get_radii()[2],
42 {
43  Vector3D v = g.get_radii();
44  BoundingBoxD<3> b(-v, v);
45  return get_transformed(b, g.get_reference_frame().get_transformation_to());
46 });
47 
48 IMPALGEBRA_END_NAMESPACE
49 
50 #endif /* IMPALGEBRA_ELLIPSOID_3D_H */
Base class for geometric types.
#define IMP_SHOWABLE_INLINE(Name, how_to_show)
Declare the methods needed by an object that can be printed.
Represent an ellipsoid in 3D.
Definition: Ellipsoid3D.h:22
static const double PI
the constant pi
A reference frame 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.
A bounding box in D dimensions.
Various useful constants.
Simple 3D transformation class.
3D rotation class.
Definition: Rotation3D.h:46
VectorD< 3 > Vector3D
Definition: VectorD.h:395
A reference frame in 3D.
#define IMP_NOT_IMPLEMENTED
Use this to mark that the method is not implemented yet.
Definition: check_macros.h:81
DensityMap * get_transformed(const DensityMap *input, const algebra::Transformation3D &tr, double threshold)
Return a new density map containing a rotated version of the old one.