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
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
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.
Vector< VectorD< D > > get_grid_interior_cover_by_spacing(const BoundingBoxD< D > &bb, double s)
VectorD< D > get_random_vector_on(const SphereD< D > &s)
Generate a random vector on a sphere with uniform density.
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.