IMP  2.2.0
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-2014 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 ellispoid in 3D.
21  \geometry
22  */
23 class IMPALGEBRAEXPORT Ellipsoid3D : public GeometricPrimitiveD<3> {
24  public:
25  Ellipsoid3D() {}
26  Ellipsoid3D(const ReferenceFrame3D &rf, const algebra::Vector3D &radii)
27  : rf_(rf), radii_(radii) {}
28  Ellipsoid3D(const Vector3D &center, double radius_x, double radius_y,
29  double radius_z, const Rotation3D &rot);
30  const Vector3D &get_radii() const { return radii_; }
31  const ReferenceFrame3D &get_reference_frame() const { return rf_; }
32  /** \deprecated_at{2.2} Use get_radii()*/
33  IMPALGEBRA_DEPRECATED_FUNCTION_DECL(2.2)
34  double get_radius(unsigned int i) const { return radii_[i]; }
35  /** \deprecated_at{2.2} Use get_reference_frame()*/
36  IMPALGEBRA_DEPRECATED_FUNCTION_DECL(2.2)
37  const Vector3D &get_center() const {
38  return rf_.get_transformation_to().get_translation();
39  }
40  /** \deprecated_at{2.2} Use get_reference_frame()*/
41  IMPALGEBRA_DEPRECATED_FUNCTION_DECL(2.2)
42  const Rotation3D &get_rotation() const {
43  return rf_.get_transformation_to().get_rotation();
44  }
45  /** \deprecated_at{2.2} Use get_reference_frame()*/
46  IMPALGEBRA_DEPRECATED_FUNCTION_DECL(2.2)
47  const Transformation3D get_transformation() const {
48  return rf_.get_transformation_to();
49  }
50  IMP_SHOWABLE_INLINE(Ellipsoid3D, out << rf_ << ": " << radii_);
51 
52  private:
53  ReferenceFrame3D rf_;
54  Vector3D radii_;
55 };
56 
57 IMP_VOLUME_GEOMETRY_METHODS(Ellipsoid3D, ellipsoid_3d, IMP_UNUSED(g);
59  return 4.0 / 3.0 * PI * g.get_radii()[0] *
60  g.get_radii()[1] * g.get_radii()[2],
61 {
62  Vector3D v = g.get_radii();
63  BoundingBoxD<3> b(-v, v);
64  return get_transformed(b, g.get_reference_frame().get_transformation_to());
65 });
66 
67 IMPALGEBRA_END_NAMESPACE
68 
69 #endif /* IMPALGEBRA_ELLIPSOID_3D_H */
Basic types used by IMP.
Simple 3D transformation class.
#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.
A reference frame in 3D.
#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
Simple 3D rotation class.