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(),
146 int number_of_points_on_cycle);
156 unsigned int number_of_points);
163 unsigned int number_of_points);
172 const unsigned int dim = bb.get_dimension();
176 for (
unsigned int i = 0; i < dim; ++i) {
183 ns[i] =
static_cast<int>(std::floor(w / s));
184 spacing[i] = w / ns[i];
185 start[i] = bb.
get_corner(0)[i] + spacing[i] * .5;
193 for (i = 0; i < dim; ++i) {
195 if (cur[i] == ns[i]) {
235 double points_per_square_angstrom);
236 IMPALGEBRA_END_NAMESPACE
IMP::base::Vector< Sphere3D > Sphere3Ds
base::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.
Simple 3D sphere patch class.
VectorD< D > get_elementwise_product(const algebra::VectorD< D > &a, const algebra::VectorD< D > &b)
const VectorD< D > & get_corner(unsigned int i) const
For 0 return lower corner and 1 upper corner.
VectorD< 3 > get_random_vector_on_unit_sphere()
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.
Vector3D get_random_vector_in(const Cylinder3D &c)
Generate a random vector in a cylinder with uniform density.
#define IMP_USAGE_CHECK(expr, message)
A runtime test for incorrect usage of a class or method.
base::Vector< VectorD< 3 > > Vector3Ds
Functions to deal with very common math operations.
A Cartesian vector in D-dimensions.
A bounding box in D dimensions.
An axis-aligned bounding box.
base::Vector< VectorD< D > > get_grid_interior_cover_by_spacing(const BoundingBoxD< D > &bb, double s)
Vector3Ds get_uniform_surface_cover(const Sphere3Ds &in, double points_per_square_angstrom)
VectorD< D > get_random_vector_on(const SphereD< D > &s)
Generate a random vector on a sphere with uniform density.
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.
BoundingBoxD< D > get_bounding_box(const BoundingBoxD< D > &g)