/* * CS5600 University of Utah * Charles McGarvey * mcgarvey@eng.utah.edu */ #ifndef _CONTACT_HH_ #define _CONTACT_HH_ #include "vec.hh" /* * A class for a collision contact. */ struct contact { vec_t p; // point of collision vec_t n; // normal of surface at collision point scal_t d; // distance along the ray }; typedef struct contact contact_t; /* * Initialize a contact with a point of contact, normal of surface at * contact point, and distance along ray. */ INLINE_MAYBE void contact_init(contact_t* c, vec_t point, vec_t normal, scal_t distance) { c->p = point; c->n = normal; c->d = distance; } /* * Create a new contact with a point of contact, normal of surface at * contact point, and distance along ray. */ INLINE_MAYBE contact_t contact_new(vec_t point, vec_t normal, scal_t distance) { contact_t c; contact_init(&c, point, normal, distance); return c; } #endif // _CONTACT_HH_