BRL-CAD
|
Functionality for generating patterns of rays. More...
Files | |
file | pattern.h |
Data Structures | |
struct | rt_pattern_data |
Macros | |
#define | RT_PATTERN_DATA_INIT_ZERO {NULL, 0, {0, 0, 0}, {0, 0, 0}, 0, NULL, 0, NULL} |
Functions | |
int | rt_raybundle_maker (struct xray *rp, double radius, const fastf_t *avec, const fastf_t *bvec, int rays_per_ring, int nring) |
int | rt_pattern (struct rt_pattern_data *data, rt_pattern_t type) |
int | rt_gen_elliptical_grid (struct xrays *rays, const struct xray *center_ray, const fastf_t *avec, const fastf_t *bvec, fastf_t gridsize) |
int | rt_gen_circular_grid (struct xrays *ray_bundle, const struct xray *center_ray, fastf_t radius, const fastf_t *up_vector, fastf_t gridsize) |
int | rt_gen_conic (struct xrays *rays, const struct xray *center_ray, fastf_t theta, vect_t up_vector, int rays_per_radius) |
int | rt_gen_frustum (struct xrays *rays, const struct xray *center_ray, const vect_t a_vec, const vect_t b_vec, const fastf_t a_theta, const fastf_t b_theta, const fastf_t a_num, const fastf_t b_num) |
int | rt_gen_rect (struct xrays *rays, const struct xray *center_ray, const vect_t a_vec, const vect_t b_vec, const fastf_t da, const fastf_t db) |
Functionality for generating patterns of rays.
#define RT_PATTERN_DATA_INIT_ZERO {NULL, 0, {0, 0, 0}, {0, 0, 0}, 0, NULL, 0, NULL} |
enum rt_pattern_t |
Available ray generation patterns
int rt_raybundle_maker | ( | struct xray * | rp, |
double | radius, | ||
const fastf_t * | avec, | ||
const fastf_t * | bvec, | ||
int | rays_per_ring, | ||
int | nring | ||
) |
Initial set of 'xrays' pattern generators that can used to feed a bundle set of rays to rt_shootrays() PRIVATE: this is new API and should be considered private for the time being.
int rt_pattern | ( | struct rt_pattern_data * | data, |
rt_pattern_t | type | ||
) |
Make a bundle of rays around a main ray using a generator
If data is NULL, return -1
If the data in the rt_pattern_data struct does not meet the requirements of the specified pattern, return -2
If data->rays is NULL, return the number of rays that would have been generated.
If data->rays is not NULL and ray_cnt does not match the number of rays that will be generated, return -3.
If data->rays is not NULL and ray_cnt matches the number of rays that will be generated, assign rays to the rays output.
Make a bundle of orthogonal rays around a center ray as a uniform rectangular grid. Grid extents are from -a_vec to a_vec and -b_vec to b_vec.
Param | Description |
---|---|
center_pt, center_dir | Initializing ray at center of pattern |
n_vec[0] | Direction for up |
n_vec[1] | Direction for right |
n_p[0] | Offset between rays in the a direction |
n_p[1] | Offset between rays in the b direction |
Make a bundle of rays around a main ray in the shape of a frustum as a uniform rectangular grid.
Param | Description |
---|---|
center_pt, center_dir | Initializing ray at center of pattern |
n_vec[0] | Direction for up |
n_vec[1] | Direction for right |
n_p[0] | angle of divergence in the direction of n_vec[0] |
n_p[1] | angle of divergence in the direction of n_vec[1] |
n_p[2] | n_p[3] |
Make a bundle of rays around a main ray using a uniform rectangular grid pattern with a circular extent.
Param | Description |
---|---|
center_pt, center_dir | Initializing ray at center of pattern |
n_vec[0] | Direction for up |
n_p[0] | grid size |
n_p[1] | Radius |
Make a bundle of rays around a main ray in the shape of a cone, using a uniform rectangular grid.
Param | Description |
---|---|
center_pt, center_dir | Initializing ray at center of pattern |
n_vec[0] | Direction for up |
n_p[0] | Angle of divergence of the cone |
n_p[1] | Number of rays that line on each radial ring of the cone |
Make a concentric set of circles of rays (rings) around a main ray.
Param | Description |
---|---|
center_pt, center_dir | Initializing ray at center of pattern |
n_p[0] | Pattern maximum radius |
n_p[1] | Number of rays per ring |
n_p[2] | Number of rings |
n_p[3] | Spiral skew |
Make a bundle of rays around a main ray using a uniform rectangular grid pattern with an elliptical extent.
Param | Description |
---|---|
center_pt, center_dir | Initializing ray at center of pattern |
n_vec[0] | Direction for up |
n_vec[1] | Direction for right |
n_p[0] | grid size |
TODO
TODO
TODO
TODO - maybe start here? http://mathworld.wolfram.com/SpherePointPicking.html
return negative on error (data will be unmodified in error condition) ray count on success (>=0)
If ray count greater than zero, data->rays array will hold rays generated by pattern
The following is an example:
int rt_gen_elliptical_grid | ( | struct xrays * | rays, |
const struct xray * | center_ray, | ||
const fastf_t * | avec, | ||
const fastf_t * | bvec, | ||
fastf_t | gridsize | ||
) |
Make a bundle of rays around a main ray using a uniform rectangular grid pattern with an elliptical extent.
avec and bvec a. The gridsize is given in mm.
rp[0].r_dir must have unit length.
int rt_gen_circular_grid | ( | struct xrays * | ray_bundle, |
const struct xray * | center_ray, | ||
fastf_t | radius, | ||
const fastf_t * | up_vector, | ||
fastf_t | gridsize | ||
) |
Make a bundle of rays around a main ray using a uniform rectangular grid pattern with a circular extent. The radius, gridsize is given in mm.
rp[0].r_dir must have unit length.
int rt_gen_conic | ( | struct xrays * | rays, |
const struct xray * | center_ray, | ||
fastf_t | theta, | ||
vect_t | up_vector, | ||
int | rays_per_radius | ||
) |
Make a bundle of rays around a main ray in the shape of a cone, using a uniform rectangular grid; theta is the angle of divergence of the cone, and rays_per_radius is the number of rays that lie on any given radius of the cone.
center_ray.r_dir must have unit length.
int rt_gen_frustum | ( | struct xrays * | rays, |
const struct xray * | center_ray, | ||
const vect_t | a_vec, | ||
const vect_t | b_vec, | ||
const fastf_t | a_theta, | ||
const fastf_t | b_theta, | ||
const fastf_t | a_num, | ||
const fastf_t | b_num | ||
) |
Make a bundle of rays around a main ray in the shape of a frustum as a uniform rectangular grid. a_vec and b_vec are the directions for up and right, respectively; a_theta and b_theta are the angles of divergence in the directions of a_vec and b_vec respectively. This is useful for creating a grid of rays for perspective rendering.
int rt_gen_rect | ( | struct xrays * | rays, |
const struct xray * | center_ray, | ||
const vect_t | a_vec, | ||
const vect_t | b_vec, | ||
const fastf_t | da, | ||
const fastf_t | db | ||
) |
Make a bundle of orthogonal rays around a center ray as a uniform rectangular grid. a_vec and b_vec are the directions for up and right, respectively; their magnitudes determine the extent of the grid (the grid extends from -a_vec to a_vec in the up-direction and from -b_vec to b_vec in the right direction). da and db are the offset between rays in the a and b directions respectively.