IMP  2.2.1
The Integrative Modeling Platform
Sphere3D.h
Go to the documentation of this file.
1 /**
2  * \file IMP/algebra/Sphere3D.h \brief Simple 3D sphere class.
3  *
4  * Copyright 2007-2014 IMP Inventors. All rights reserved.
5  *
6  */
7 
8 #ifndef IMPALGEBRA_SPHERE_3D_H
9 #define IMPALGEBRA_SPHERE_3D_H
10 
11 #include "SphereD.h"
12 
13 IMPALGEBRA_BEGIN_NAMESPACE
14 
15 //! Return a sphere containing the listed spheres
16 /** See Sphere3D
17  \note This method produces tighter bounding spheres if CGAL
18  is used.
19  \ingroup CGAL
20  */
21 IMPALGEBRAEXPORT Sphere3D get_enclosing_sphere(const Sphere3Ds &ss);
22 
23 //! Return a sphere containing the listed spheres
24 /** See Sphere3D
25  See Vector3D
26  \note This method produces tighter bounding spheres if CGAL
27  is used.
28  \ingroup CGAL
29  */
30 IMPALGEBRAEXPORT Sphere3D get_enclosing_sphere(const Vector3Ds &ss);
31 
32 //! Return the radius of a sphere with a given volume
33 /** See Sphere3D
34  */
35 inline double get_ball_radius_from_volume_3d(double volume) {
36  IMP_USAGE_CHECK(volume >= 0, "Volume can't be negative");
37  return std::pow((.75 / PI) * volume, .3333);
38 }
39 
40 #ifdef IMP_ALGEBRA_USE_IMP_CGAL
41 /** Return the surface area and volume of the union of the balls
42  bounded by the spheres. This method requires CGAL to work.
43 */
44 IMPALGEBRAEXPORT FloatPair
46 #endif
47 
48 /** Return a set of balls that approximates the surface of the passed set within
49  * the error tolerance.
50  *
51  * The any point in the old surface will be within
52  * roughly maximum_allowed_error_angstroms of a point in the new surface and any
53  * point outside the old volume will be within roughly
54  * maximum_allowed_error_angstroms of a point outside the new volume.
55  *
56  * \note The name may change if someone thinks up a better one.
57  */
58 IMPALGEBRAEXPORT Sphere3Ds
60  double maximum_allowed_error_angstroms);
61 
62 IMPALGEBRA_END_NAMESPACE
63 
64 #endif /* IMPALGEBRA_SPHERE_3D_H */
IMP::base::Vector< Sphere3D > Sphere3Ds
Definition: SphereD.h:89
SphereD< 3 > Sphere3D
Definition: SphereD.h:89
static const double PI
the constant pi
std::pair< double, double > FloatPair
A generic pair of floats.
Definition: base/types.h:27
double get_ball_radius_from_volume_3d(double volume)
Return the radius of a sphere with a given volume.
Definition: Sphere3D.h:35
Simple 3D sphere class.
#define IMP_USAGE_CHECK(expr, message)
A runtime test for incorrect usage of a class or method.
base::Vector< VectorD< 3 > > Vector3Ds
Definition: VectorD.h:397
FloatPair get_surface_area_and_volume(const algebra::Sphere3Ds &ss)
Sphere3Ds get_simplified_from_volume(Sphere3Ds in, double maximum_allowed_error_angstroms)
Sphere3D get_enclosing_sphere(const Vector3Ds &ss)
Return a sphere containing the listed spheres.