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

  1. /*
  2.  * GeoObject.h - class definition of abstract base class GeoObject 
  3.  *               (parent to all geometric primitives).
  4.  *
  5.  * Copyright (C) 1992, Christoph Streit (streit@iam.unibe.ch)
  6.  * All rights reserved.
  7.  *
  8.  * This software may be freely copied, modified, and redistributed
  9.  * provided that this copyright notice is preserved on all copies.
  10.  *
  11.  * You may not distribute this software, in whole or in part, as part of
  12.  * any commercial product without the express consent of the authors.
  13.  *
  14.  * There is no warranty or other guarantee of fitness of this software
  15.  * for any purpose.  It is provided solely "as is".
  16.  *
  17.  */
  18.  
  19. #ifndef GeoObject_H
  20. # define GeoObject_H
  21.  
  22. #include "Vector.h"
  23. #include "BoundingBox.h"
  24. #include "Polygon.h"
  25. #include "boolean.h"
  26. #include "list.h"
  27. #include "Ray.h"
  28.  
  29. //___________________________________________________________ GeoObject
  30.  
  31. class GeoObject
  32. {
  33. public:
  34.   GeoObject();
  35.   virtual ~GeoObject();
  36.  
  37.   virtual int intersect(const Ray&, real, real&)=0;
  38.   Vector getNormal(const Vector&) const;
  39.   virtual Vector normal(const Vector&) const =0;
  40.   virtual PolygonList* tesselate(const BoundingBox&)=0;
  41.  
  42.   virtual int setTransform(TransMatrix*);
  43.   TransMatrix* getTrans() const;
  44.   TransMatrix* getInvTrans() const;
  45.  
  46.   static long getIntersectionTests();
  47.   static long getIntersections();
  48.  
  49. protected:
  50.   TransMatrix* trans;
  51.   TransMatrix* itrans;
  52.   static long intersectionTests;
  53.   static long intersections;
  54. };
  55.  
  56. typedef GeoObject* GeoObjectPtr;
  57. declareList(GeoObjectList, GeoObjectPtr);
  58.  
  59. inline TransMatrix* GeoObject::getTrans() const {
  60.   return trans;
  61. }
  62.  
  63. inline TransMatrix* GeoObject::getInvTrans() const {
  64.   return itrans;
  65. }
  66.  
  67. inline long GeoObject::getIntersectionTests() {
  68.   return intersectionTests;
  69. }
  70.  
  71. inline long GeoObject::getIntersections() {
  72.   return intersections;
  73. }
  74.  
  75. #endif // GeoObject_H
  76.  
  77.