]>
Dogcows Code - chaz/rasterize/blob - ray.hh
3 * CS5600 University of Utah
5 * mcgarvey@eng.utah.edu
22 typedef struct ray ray_t
;
25 * Initialize a ray with an origin point and a direction.
28 void ray_init(ray_t
* r
, vec_t origin
, vec_t direction
)
36 * Create a new ray with an origin point and a direction.
39 ray_t
ray_new(vec_t origin
, vec_t direction
)
42 ray_init(&r
, origin
, direction
);
48 * Normalize the direction of a ray.
51 ray_t
ray_normalize(ray_t r
)
53 return ray_new(r
.o
, vec_normalize(r
.d
));
58 * Solve for a point along the array, given a distance. The ray must be
59 * normalized for this to work as expected.
62 vec_t
ray_solve(ray_t r
, scal_t distance
)
64 return vec_add(r
.o
, vec_scale(r
.d
, distance
));
This page took 0.041479 seconds and 4 git commands to generate.