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

  1. /* ------------------------------------------------------------------------- *\
  2.    QUAD_GG.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_GG_
  11. #define _QUAD_GG_
  12.  
  13. #include <math.h>
  14. #include "../ch7-7/GG4D/GGems.h"
  15.  
  16. /*
  17. ** Type definitions
  18. */
  19. typedef double   REAL;
  20.  
  21. typedef struct {
  22.     Point3   A,B,C,D;   /* Vertices in counter clockwise order */
  23.     Vector3  Normal;    /* Normal vector pointing outwards     */
  24. } QUAD;
  25.  
  26. typedef struct {
  27.     Point3   Point;     /* Ray origin                          */
  28.     Vector3  Vector;    /* Ray direction                       */
  29. } RAY;
  30.  
  31. typedef struct {
  32.     Point3   Point;     /* Intersection point                               */
  33.     REAL     Distance;  /* Distance from ray origin to intersection point   */
  34.     REAL     u, v;      /* Parametric coordinates of the intersection point */
  35. } HIT;
  36.  
  37. /*
  38. ** External declarations
  39. */
  40. extern boolean ray_hit_quad (RAY *, QUAD *, HIT *);
  41.  
  42. #endif
  43.  
  44. /* ------------------------------------------------------------------------- */
  45.