home *** CD-ROM | disk | FTP | other *** search
/ RISC DISC 3 / RISC_DISC_3.iso / resources / etexts / gems / gemsv / ch5_2 / quad.h < prev    next >
C/C++ Source or Header  |  1995-04-04  |  1KB  |  47 lines

  1. /* ------------------------------------------------------------------------- *\
  2.    QUAD.H :
  3.  
  4.    by Christophe Schlick and Gilles Subrenat (15 May 1994)
  5.  
  6.    "Ray Intersection of Tessellated Surfaces : Quadrangles versus Triangles"
  7.    in Graphics Gems V (edited by A. Paeth), Academic Press
  8. \* ------------------------------------------------------------------------- */
  9.  
  10. #ifndef _QUAD_
  11. #define _QUAD_
  12.  
  13. #include <math.h>
  14. #include "../ch7-7/mactbox/tool.h"
  15. #include "../ch7-7/mactbox/real.h"
  16. #include "../ch7-7/mactbox/vec2.h"
  17. #include "../ch7-7/mactbox/vec3.h"
  18.  
  19.  
  20. /*
  21. ** Type definitions
  22. */
  23. typedef struct {
  24.     realvec3  A,B,C,D;   /* Vertices in counter clockwise order */
  25.     realvec3  Normal;    /* Normal vector pointing outwards     */
  26. } QUAD;
  27.  
  28. typedef struct {
  29.     realvec3  Point;     /* Ray origin                          */
  30.     realvec3  Vector;    /* Ray direction                       */
  31. } RAY;
  32.  
  33. typedef struct {
  34.     realvec3  Point;     /* Intersection point                               */
  35.     real      Distance;  /* Distance from ray origin to intersection point   */
  36.     real      u, v;      /* Parametric coordinates of the intersection point */
  37. } HIT;
  38.  
  39. /*
  40. ** External declarations
  41. */
  42. extern bool ray_hit_quad (RAY *, QUAD *, HIT *);
  43.  
  44. #endif
  45.  
  46. /* ------------------------------------------------------------------------- */
  47.