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);
61 double r2 = get_squared(s.get_radius());
65 norm = (s.get_center() - ret).get_squared_magnitude();
109 return internal::uniform_cover_sphere(n, s.get_center(), s.get_radius(),
127 return internal::uniform_cover_sphere(n, s.get_center(), s.get_radius(),
137 int number_of_points_on_cycle);
147 unsigned int number_of_points);
154 unsigned int number_of_points);
163 const unsigned int dim = bb.get_dimension();
167 for (
unsigned int i = 0; i < dim; ++i) {
174 ns[i] =
static_cast<int>(std::floor(w / s));
175 spacing[i] = w / ns[i];
176 start[i] = bb.
get_corner(0)[i] + spacing[i] * .5;
184 for (i = 0; i < dim; ++i) {
186 if (cur[i] == ns[i]) {
216 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.
VectorD< D > get_random_vector_on(const BoundingBoxD< D > &bb)
Generate a random vector on a box with uniform density.
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.
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.
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.
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.
VectorD< D > get_random_vector_in(const BoundingBoxD< D > &bb)
Generate a random vector in a box with uniform density.
An axis-aligned bounding box.
base::Vector< VectorD< D > > get_grid_interior_cover_by_spacing(const BoundingBoxD< D > &bb, double s)
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)