IMP  2.3.1
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 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  /** \deprecated_at{2.2} Use get_radii()*/
32  IMPALGEBRA_DEPRECATED_FUNCTION_DECL(2.2)
33  double get_radius(unsigned int i) const { return radii_[i]; }
34  /** \deprecated_at{2.2} Use get_reference_frame()*/
35  IMPALGEBRA_DEPRECATED_FUNCTION_DECL(2.2)
36  const Vector3D &get_center() const {
37  return rf_.get_transformation_to().get_translation();
38  }
39  /** \deprecated_at{2.2} Use get_reference_frame()*/
40  IMPALGEBRA_DEPRECATED_FUNCTION_DECL(2.2)
41  const Rotation3D &get_rotation() const {
42  return rf_.get_transformation_to().get_rotation();
43  }
44  /** \deprecated_at{2.2} Use get_reference_frame()*/
45  IMPALGEBRA_DEPRECATED_FUNCTION_DECL(2.2)
46  const Transformation3D get_transformation() const {
47  return rf_.get_transformation_to();
48  }
49  IMP_SHOWABLE_INLINE(Ellipsoid3D, out << rf_ << ": " << radii_);
50 
51  private:
52  ReferenceFrame3D rf_;
53  Vector3D radii_;
54 };
55 
56 IMP_VOLUME_GEOMETRY_METHODS(Ellipsoid3D, ellipsoid_3d, IMP_UNUSED(g);
58  return 4.0 / 3.0 * PI * g.get_radii()[0] *
59  g.get_radii()[1] * g.get_radii()[2],
60 {
61  Vector3D v = g.get_radii();
62  BoundingBoxD<3> b(-v, v);
63  return get_transformed(b, g.get_reference_frame().get_transformation_to());
64 });
65 
66 IMPALGEBRA_END_NAMESPACE
67 
68 #endif /* IMPALGEBRA_ELLIPSOID_3D_H */
Basic types used by IMP.
Simple 3D transformation class.
#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
Simple 3D rotation class.
#define IMP_NOT_IMPLEMENTED
Use this to mark that the method is not implemented yet.
Definition: check_macros.h:83