
Public Member Functions | |
| const VectorD< D > & | get_center () const |
| bool | get_contains (const VectorD< D > &p) const |
| Return true if the point is in or on the surface of the sphere. | |
| bool | get_contains (const SphereD< D > &o) const |
| Return true if this sphere contains the other one. | |
| double | get_radius () const |
| SphereD (const VectorD< D > ¢er, double radius) | |
Related Functions | |
| (Note that these are not member functions.) | |
| double | get_ball_radius_from_volume_3d (double volume) |
| Return the radius of a sphere with a given volume. | |
| template<unsigned int D> | |
| double | get_distance (const SphereD< D > &a, const SphereD< D > &b) |
| Return the distance between the two spheres if they are disjoint. | |
| SphereD< 3 > | get_enclosing_sphere (const std::vector< SphereD< 3 > > &ss) |
| Return a sphere containing the listed spheres. | |
| template<unsigned 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<unsigned int D> | |
| double | get_power_distance (const SphereD< D > &a, const SphereD< D > &b) |
| Return the power distance between the two spheres. | |
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<unsigned int D> | |
| VectorD< D > | get_random_vector_in (const SphereD< D > &s) |
| Generate a random vector in a sphere with uniform density. | |
| template<unsigned int D> | |
| VectorD< D > | get_random_vector_on (const SphereD< D > &s) |
| Generate a random vector on a sphere with uniform density. | |
| template<unsigned int D> | |
| std::vector< VectorD< D > > | get_uniform_surface_cover (const SphereD< D > &s, unsigned int n) |
| Generate a set of vectors which covers a sphere uniformly. | |
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. | |
| std::vector< SphereD< 3 > > | read_spheres (TextInput in) |
| Read a set of 3d spheres from a file. | |
| void | write_spheres (const std::vector< VectorD< 3 > > &vs, TextOutput out) |
| Write a set of 3d spheres to a file. | |
| double get_ball_radius_from_volume_3d | ( | double | volume | ) | [related] |
Return the radius of a sphere with a given volume.
<3>
| 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.
| SphereD< 3 > get_enclosing_sphere | ( | const std::vector< SphereD< 3 > > & | ss | ) | [related] |
Return a sphere containing the listed spheres.
<3>
| 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.
| std::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.
| void write_spheres | ( | const std::vector< VectorD< 3 > > & | vs, | |
| TextOutput | out | |||
| ) | [related] |