9 #ifndef IMPALGEBRA_VECTOR_GENERATORS_H
10 #define IMPALGEBRA_VECTOR_GENERATORS_H
19 #include "internal/grid_range_d.h"
20 #include "internal/internal_vector_generators.h"
22 IMPALGEBRA_BEGIN_NAMESPACE
49 return internal::RandomVectorOnBB<D>::get(bb);
58 IMP_USAGE_CHECK(s.get_radius() > 0,
"The sphere must have positive radius");
62 double r2 = get_squared(s.get_radius());
66 norm = (s.get_center() - ret).get_squared_magnitude();
118 return internal::uniform_cover_sphere(n, s.get_center(), s.get_radius(),
136 return internal::uniform_cover_sphere(n, s.get_center(), s.get_radius(),
155 int number_of_points_on_cycle);
165 unsigned int number_of_points);
172 unsigned int number_of_points);
181 const unsigned int dim = bb.get_dimension();
185 for (
unsigned int i = 0; i < dim; ++i) {
192 ns[i] =
static_cast<int>(std::floor(w / s));
193 spacing[i] = w / ns[i];
194 start[i] = bb.
get_corner(0)[i] + spacing[i] * .5;
202 for (i = 0; i < dim; ++i) {
204 if (cur[i] == ns[i]) {
244 double points_per_square_angstrom);
245 IMPALGEBRA_END_NAMESPACE
Simple 3D sphere patch class.
VectorD< D > get_elementwise_product(const algebra::VectorD< D > &a, const algebra::VectorD< D > &b)
Return the vector that is the elementwise product of the two.
const VectorD< D > & get_corner(unsigned int i) const
For 0 return lower corner and for 1, the upper corner.
VectorD< 3 > get_random_vector_on_unit_sphere()
Represent a cylinder in 3D.
Vector3Ds get_random_chain(unsigned int n, double r, const Vector3D &start=Vector3D(0, 0, 0), const Sphere3Ds &obstacles=Sphere3Ds())
Generate a random chain with no collisions.
Vector< VectorD< 3 > > Vector3Ds
Represent a unit simplex embedded in D-dimensional real space.
A more IMP-like version of the std::vector.
Vector3D get_random_vector_in(const Cylinder3D &c)
Generate a random vector in a cylinder with uniform density.
Functions to deal with very common math operations.
A Cartesian vector in D-dimensions.
BoundingBoxD< 3 > get_bounding_box(const Cone3D &g)
A bounding box in D dimensions.
IMP::Vector< Sphere3D > Sphere3Ds
An axis-aligned bounding box.
Vector3Ds get_uniform_surface_cover(const Sphere3Ds &in, double points_per_square_angstrom)
#define IMP_USAGE_CHECK(expr, message)
A runtime test for incorrect usage of a class or method.
VectorD< D > get_random_vector_on(const UnitSimplexD< D > &s)
Generate a random vector on a unit simplex with uniform density.
Vector< VectorD< D > > get_grid_interior_cover_by_spacing(const BoundingBoxD< D > &bb, double s)
Vector< VectorD< D > > get_uniform_upper_hemisphere_cover(const SphereD< D > &s, unsigned int n)
Generate a set of 3D points that uniformly cover a hemisphere.
Vector3Ds get_grid_surface_cover(const Cylinder3D &cyl, int number_of_cycles, int number_of_points_on_cycle)
Generate a grid of 3d points on a cylinder surface.
Represent a sphere in D-dimensions.