IMP logo
Public Member Functions | Related Functions
IMP::algebra::SphereD< D > Class Template Reference

Detailed Description

template<int D>
class IMP::algebra::SphereD< D >

Represent a sphere in D-dimensions.

Note:
This class is a geometric primitive. Also, this class is not not initialized by its default constructor.

Examples: XYZR Decorator, grid space, cube, filter close pairs, merge tree, rigid brownian dynamics, kmeans, analyze convergence, optimize balls, connectivity restraint, basic geometry

List of all members.

Public Member Functions

 SphereD (const VectorD< D > &center, double radius)
const VectorD< D > & get_center () const
bool get_contains (const SphereD< D > &o) const
 Return true if this sphere contains the other one.
bool get_contains (const VectorD< D > &p) const
 Return true if the point is in or on the surface of the sphere.
unsigned int get_dimension () const
double get_radius () const
void show (std::ostream &out=std::cout) const

Simple geometric IO

These functions write geometry to text files, one line per geometric primitive. Each line has the form “x y z” for points or “x y z r” for spheres. We can easily add general dimension support if requested.. Lines beginning with "" are treated as comments.

void write_spheres (const Sphere3Ds &vs, base::TextOutput out)
 Write a set of 3d spheres to a file.
Sphere3Ds read_spheres (base::TextInput input)
 Read a set of 3d spheres from a file.

Vector Generators

These functions generate vector objects. Some of the methods, those with random in their name, generate a single vector chosen uniformly from the specified domain. Others, the cover methods, generate a set of points distributed (somewhat) evenly over the domain.

template<int D>
VectorD< D > get_random_vector_in (const SphereD< D > &s)
 Generate a random vector in a sphere with uniform density.
VectorD< 2 > get_random_vector_in (const SphereD< 2 > &s)
template<int D>
VectorD< D > get_random_vector_on (const SphereD< D > &s)
 Generate a random vector on a sphere with uniform density.
template<int D>
base::Vector< VectorD< D > > get_uniform_surface_cover (const SphereD< D > &s, unsigned int n)
 Generate a set of vectors which covers a sphere uniformly.

Related Functions

(Note that these are not member functions.)

template<int D>
double get_distance (const SphereD< D > &a, const SphereD< D > &b)
 Return the distance between the two spheres if they are disjoint.
template<int D>
bool get_interiors_intersect (const SphereD< D > &a, const SphereD< D > &b)
 Return true if the two balls bounded by the two spheres interesect.
template<int D>
double get_power_distance (const SphereD< D > &a, const SphereD< D > &b)
 Return the power distance between the two spheres.

Member Function Documentation

template<int D>
bool IMP::algebra::SphereD< D >::get_contains ( const SphereD< D > &  o) const

Return true if this sphere contains the other one.

template<int D>
bool IMP::algebra::SphereD< D >::get_contains ( const VectorD< D > &  p) const

Return true if the point is in or on the surface of the sphere.


Friends And Related Function Documentation

template<int D>
double get_distance ( const SphereD< D > &  a,
const SphereD< D > &  b 
)
related

Return the distance between the two spheres if they are disjoint.

If they intersect, the distances are not meaningful.

template<int D>
bool get_interiors_intersect ( const SphereD< D > &  a,
const SphereD< D > &  b 
)
related

Return true if the two balls bounded by the two spheres interesect.

template<int D>
double get_power_distance ( const SphereD< D > &  a,
const SphereD< D > &  b 
)
related

Return the power distance between the two spheres.

The power distance is the square of the distance between the centers minus the sum of the square of the radii.

template<int D>
VectorD< D > get_random_vector_in ( const SphereD< D > &  s)
related

Generate a random vector in a sphere with uniform density.

template<int D>
VectorD< 2 > get_random_vector_in ( const SphereD< 2 > &  s)
related

Generates a random vector in a circle with uniform density with respect to the area of the circle

Parameters:
sa 2D sphere (circle)

VectorD

template<int D>
VectorD< D > get_random_vector_on ( const SphereD< D > &  s)
related

Generate a random vector on a sphere with uniform density.

template<int D>
base::Vector< VectorD< D > > get_uniform_surface_cover ( const SphereD< D > &  s,
unsigned int  n 
)
related

Generate a set of vectors which covers a sphere uniformly.

The function is currently pretty slow, especially in non-optimized builds. Complain if this bugs you. We might be able to do better, at least in 3D.

Creates at least the requested number of points.

Note:
This predicates will produce guaranteed correct results if the CGAL library is available (the results will be unreliable if it is not).
template<int D>
Sphere3Ds read_spheres ( base::TextInput  input)
related

Read a set of 3d spheres from a file.

See also:
write_pts
template<int D>
void write_spheres ( const Sphere3Ds &  vs,
base::TextOutput  out 
)
related

Write a set of 3d spheres to a file.

See also:
read_pts

The documentation for this class was generated from the following files:

Generated on Tue May 22 2012 23:33:25 for IMP by doxygen 1.8.1