BRL-CAD
Loading...
Searching...
No Matches
Collaboration diagram for AABB/Ray Intersection Tests:

Functions

void bg_ray_invdir (vect_t *invdir, const vect_t dir)
 Intersection between an infinite line and an axis-aligned box.
 
int bg_isect_aabb_ray (fastf_t *r_min, fastf_t *r_max, const point_t opt, const fastf_t *invdir, const fastf_t *aabb_min, const fastf_t *aabb_max)
 

Detailed Description

Function Documentation

◆ bg_ray_invdir()

void bg_ray_invdir ( vect_t invdir,
const vect_t  dir 
)
extern

Intersection between an infinite line and an axis-aligned box.

Compute the inverse direction components for use with bg_isect_aabb_ray(). Components within SQRT_SMALL_FASTF of zero are represented by INFINITY. The input direction is not modified.

◆ bg_isect_aabb_ray()

int bg_isect_aabb_ray ( fastf_t r_min,
fastf_t r_max,
const point_t  opt,
const fastf_t invdir,
const fastf_t aabb_min,
const fastf_t aabb_max 
)
extern

Test the infinite line defined by opt and the reciprocal direction vector invdir against an axis-aligned bounding box. Despite its historical name, this function does not reject intersections behind opt: a successful result can have both output parameters negative. Callers that require a forward ray must additionally require *r_max >= 0.0.

On success, r_min and r_max are the entry and exit line parameters. They are valid only when the function returns 1.