]> Dogcows Code - chaz/rasterize/blob - contact.hh
finishing fifth project
[chaz/rasterize] / contact.hh
1
2 /*
3 * CS5600 University of Utah
4 * Charles McGarvey
5 * mcgarvey@eng.utah.edu
6 */
7
8 #ifndef _CONTACT_HH_
9 #define _CONTACT_HH_
10
11 #include "vec.hh"
12
13
14 /*
15 * A class for a collision contact.
16 */
17 struct contact
18 {
19 vec_t p; // point of collision
20 vec_t n; // normal of surface at collision point
21 scal_t d; // distance along the ray
22 };
23 typedef struct contact contact_t;
24
25 /*
26 * Initialize a contact with a point of contact, normal of surface at
27 * contact point, and distance along ray.
28 */
29 INLINE_MAYBE
30 void contact_init(contact_t* c, vec_t point, vec_t normal, scal_t distance)
31 {
32 c->p = point;
33 c->n = normal;
34 c->d = distance;
35 }
36
37
38 /*
39 * Create a new contact with a point of contact, normal of surface at
40 * contact point, and distance along ray.
41 */
42 INLINE_MAYBE
43 contact_t contact_new(vec_t point, vec_t normal, scal_t distance)
44 {
45 contact_t c;
46 contact_init(&c, point, normal, distance);
47 return c;
48 }
49
50
51 #endif // _CONTACT_HH_
52
This page took 0.041366 seconds and 4 git commands to generate.