|
geomc 1.0
A c++ linear algebra template library
|
A class for randomly sampling a variety of regions over RN space.
More...
#include <geomc/random/RandomTools.h>
Public Member Functions | |
| Sampler () | |
| Sampler (Random *rng) | |
| template<index_t N> | |
| Vec< T, N > | unit () |
| template<index_t N> | |
| Vec< T, N > | unit (T radius) |
| template<index_t N> | |
| Vec< T, N > | solidball () |
| template<index_t N> | |
| Vec< T, N > | solidball (T radius) |
| template<index_t N> | |
| Vec< T, N > | shell (T minradius, T maxradius) |
| template<index_t N> | |
| Vec< T, N > | box () |
| template<index_t N> | |
| Vec< T, N > | box (Vec< T, N > lo, Vec< T, N > hi) |
| template<index_t N> | |
| Vec< T, N > | box (const Rect< T, N > &box) |
| Vec< T, 3 > | cap (T half_angle_radians) |
| Vec< T, 3 > | cap (Vec< T, 3 > dir, T half_angle_radians) |
| Vec< T, 3 > | solidcap (Vec< T, 3 > dir, T half_angle_radians, T minR, T maxR) |
| Vec< T, 3 > | oriented_disk (Vec< T, 3 > normal, T r) |
| Vec< T, 3 > | box (T minx, T miny, T minz, T maxx, T maxy, T maxz) |
| Vec< T, 2 > | disk () |
| Vec< T, 2 > | disk (T radius) |
| Vec< T, 2 > | arc (T min_radians, T max_radians) |
| Vec< T, 2 > | solidarc (T min_radians, T max_radians, T min_radius, T max_radius) |
| Vec< T, 2 > | box (T minx, T miny, T maxx, T maxy) |
Public Attributes | |
| Random * | rng |
A class for randomly sampling a variety of regions over RN space.
A random vector of unit length may be generated by:
Random *rng = new MTRand(mySeed); Sampler<double> rvg(rng); Vec<double,3> p = rvg.unit<3>();
|
inline |
Construct a new Sampler using the default (non-reentrant) pseudorandom number generator as the source of random bits.
Construct a new Sampler with the supplied random number generator as the source of random bits.
| rng | A (pseudo-) random number generator. |
|
inline |
Generate a unit 2D vector with random angle. The entire rangle of angles between min_radians and max_radians may be sampled, so consider whether to use a negative minimum for ranges of direction which cross the +x axis.
| min_radians | Minimum angle of generated vector counterclockwise from the +x axis, in radians. |
| max_radians | Maximum angle of generated vector counterclockwise from the +x axis, in radians. |
min_radians and max_radians. | N | Dimension of generated sample. |
(0, 1)N. | N | Dimension of generated sample. |
| box | Region to sample. |
|
inline |
|
inline |
| N | Dimension of generated sample. |
| lo | Minimum coordinates of sample. |
| hi | Maximum coordinates of sample. |
lo and hi.
|
inline |
| half_angle_radians | Angle from the z+ axis to the cap's edge. |
half_angle_radians. | dir | Direction about which to sample. |
| half_angle_radians | Angle from dir to sample within. |
dir, with angle half_angle_radians between the axis and edge of the cap.
|
inline |
Synonym for solidball<2>().
|
inline |
Synonym for solidball<2>(T).
| radius |
r and centered at the origin. Samples are uniformly distributed across the area of the disk. | normal | Normal of the disk to sample. |
| r | Radius of disk to sample. |
r and normal n. | N | Dimension of generated sample. |
| minradius | Minimum length of generated sample. |
| maxradius | Maximum length of generated sample. |
|
inline |
Generate a 2D vector with random angle and a random length. The entire rangle of angles between min_radians and max_radians may be sampled, so consider whether to use a negative minimum for ranges of direction which cross the +x axis. The generated samples will be uniformly distributed throughout the sampled area.
| min_radians | Minimum angle of generated vector counterclockwise from the +x axis, in radians. |
| max_radians | Maximum angle of generated vector counterclockwise from the +x axis, in radians. |
| min_radius | Minimum length of generated vector. |
| max_radius | Maximum length of generated vector. |
min_radius and max_radius and heading between min_radians and max_radians. | N | Dimension of generated sample. |
| N | Dimension of generated sample. |
| radius | Radius of sphere in which to sample. |
radius. Samples are uniformly distributed throughout the volume.
|
inline |
| dir | Direction about which to sample. |
| half_angle_radians | Angle from dir to sample within. |
| minR | Minimum distance of sample from origin. |
| maxR | Maximum distance of sample from origin. |
half_angle_radians and between the surfaces of two spheres with radii minR and maxR, uniformly distributed throughout the volume. | N | Dimension of generated sample. |
RN sphere. | N | Dimension of generated sample. |
| radius | Length of generated vector. |
radius. Distribution is uniform over the surface of the RN sphere.