IMP logo
IMP Reference Guide  develop.63b38c487d,2024/12/21
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-2022 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 vectors
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 //! Get surface area & volume of the union of the balls bounded by the spheres.
42 /** This method requires CGAL to work.
43  */
44 IMPALGEBRAEXPORT FloatPair
46 #endif
47 
48 //! Get a set of balls that approximates the surface of the passed set.
49 /** Any point in the old surface will be within roughly
50  maximum_allowed_error_angstroms of a point in the new surface and any
51  point outside the old volume will be within roughly
52  maximum_allowed_error_angstroms of a point outside the new volume.
53 
54  \note The name may change if someone thinks up a better one.
55  */
56 IMPALGEBRAEXPORT Sphere3Ds
58  double maximum_allowed_error_angstroms);
59 
60 IMPALGEBRA_END_NAMESPACE
61 
62 #endif /* IMPALGEBRA_SPHERE_3D_H */
SphereD< 3 > Sphere3D
Typedef for Python.
Definition: SphereD.h:104
static const double PI
the constant pi
Vector< VectorD< 3 > > Vector3Ds
Definition: VectorD.h:410
std::pair< double, double > FloatPair
A generic pair of floats.
Definition: types.h:26
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.
FloatPair get_surface_area_and_volume(const algebra::Sphere3Ds &ss)
Get surface area & volume of the union of the balls bounded by the spheres.
IMP::Vector< Sphere3D > Sphere3Ds
Definition: SphereD.h:104
#define IMP_USAGE_CHECK(expr, message)
A runtime test for incorrect usage of a class or method.
Definition: check_macros.h:168
Sphere3Ds get_simplified_from_volume(Sphere3Ds in, double maximum_allowed_error_angstroms)
Get a set of balls that approximates the surface of the passed set.
Sphere3D get_enclosing_sphere(const Vector3Ds &ss)
Return a sphere containing the listed vectors.