home *** CD-ROM | disk | FTP | other *** search
/ BCI NET 2 / BCI NET 2.iso / archives / programming / source / graphicgems4.lha / GemsIV / vec_mat / ray / Polyhedron.h < prev    next >
Encoding:
C/C++ Source or Header  |  1995-02-06  |  1.4 KB  |  45 lines

  1. /************************************************************************
  2. *                                    *
  3. * CLASS: Polyhedron                            *
  4. * AUTHOR: Jean-Francois DOUE                        *
  5. * LAST MODIFICATION: 12 Oct 1993                    *
  6. *                                    *
  7. * This class implements a 3D concave polyhedron.            *
  8. * The polyhedron is defined by the following elements:            *
  9. * + an array which contains the its vertices (vList).            *
  10. * + an array of "facets" (iList). Each facet is itself defined as an    *
  11. *   array of integer. The first one is the number of points composing    *
  12. *   the facet. The other ones are the indices of these vertices in the    *
  13. *   vList array.                            *
  14. * + an array of dimension 4 vectors, which stores the equations of the    *
  15. *   planes on which the facets lie.                    *
  16. *                                    *
  17. ************************************************************************/
  18.  
  19. #ifndef Polyhedron_h
  20. #define Polyhedron_h 1
  21. #include "Primitive.h"
  22.  
  23. class Polyhedron : public Primitive
  24. {
  25. protected:
  26.  vec3    *vList;        // vertices of the polyhedron
  27.  vec4    *pList;        // equations for the planes supporting the facets
  28.  int    vertexN,    // number of vertices of the polyhedron
  29.     facetN,        // number of facets of the polyhedron
  30.     **iList;    // lists of the vertex indices which define the facets
  31.  
  32. public:
  33.  
  34.  // Constructors and destructors
  35.  ~Polyhedron();
  36.  
  37.  // virtual methods
  38.  double intersect(vec3& ray_org, vec3& ray_dir);
  39.  vec3 normalAt(vec3& p);
  40.  
  41.  // friends
  42.  friend istream& operator >> (istream& s, Polyhedron& a);
  43. };
  44.  
  45. #endif