home *** CD-ROM | disk | FTP | other *** search
/ Photo CD Demo 1 / Demo.bin / graphtal / triangle.h < prev    next >
C/C++ Source or Header  |  1992-10-22  |  1KB  |  46 lines

  1. /*
  2.  * Triangle.h - class definition for geometric object triangle.
  3.  *
  4.  * Copyright (C) 1992, Christoph Streit (streit@iam.unibe.ch)
  5.  * All rights reserved.
  6.  *
  7.  * This software may be freely copied, modified, and redistributed
  8.  * provided that this copyright notice is preserved on all copies.
  9.  *
  10.  * You may not distribute this software, in whole or in part, as part of
  11.  * any commercial product without the express consent of the authors.
  12.  *
  13.  * There is no warranty or other guarantee of fitness of this software
  14.  * for any purpose.  It is provided solely "as is".
  15.  *
  16.  */
  17.  
  18. #ifndef Triangle_H
  19. # define Triangle_H
  20.  
  21. #include "GeoObject.h"
  22.  
  23. //___________________________________________________________ Triangle
  24.  
  25. class Triangle : public GeoObject 
  26. {
  27. public:
  28.   static GeoObject* create(const Vector&, const Vector&, const Vector&);
  29.  
  30.   int intersect(const Ray&, real, real&);
  31.   Vector normal(const Vector&) const;
  32.   PolygonList* tesselate(const BoundingBox&);
  33.  
  34. private:
  35.   Triangle(const Vector&, const Vector&, const Vector&);
  36.  
  37. private:
  38.   Vector v1, v2, v3; // triangle vertices
  39.   Vector e1, e2;     // triangle edges (scaled)
  40.   Vector n;          // triangle normal
  41.   real D;            // plane constant
  42.   int index1, index2;
  43. };
  44.  
  45. #endif // Triangle_H
  46.