home *** CD-ROM | disk | FTP | other *** search
/ Frozen Fish 1: Amiga / FrozenFish-Apr94.iso / bbs / oct93 / graphics / graphtal.lha / Graphtal / GeoObject.h < prev    next >
C/C++ Source or Header  |  1992-11-17  |  2KB  |  78 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.  *                     University of Berne, Switzerland
  7.  * All rights reserved.
  8.  *
  9.  * This software may be freely copied, modified, and redistributed
  10.  * provided that this copyright notice is preserved on all copies.
  11.  *
  12.  * You may not distribute this software, in whole or in part, as part of
  13.  * any commercial product without the express consent of the authors.
  14.  *
  15.  * There is no warranty or other guarantee of fitness of this software
  16.  * for any purpose.  It is provided solely "as is".
  17.  *
  18.  */
  19.  
  20. #ifndef GeoObject_H
  21. # define GeoObject_H
  22.  
  23. #include "Vector.h"
  24. #include "BoundingBox.h"
  25. #include "Polygon.h"
  26. #include "boolean.h"
  27. #include "list.h"
  28. #include "Ray.h"
  29.  
  30. //___________________________________________________________ GeoObject
  31.  
  32. class GeoObject
  33. {
  34. public:
  35.   GeoObject();
  36.   virtual ~GeoObject();
  37.  
  38.   virtual int intersect(const Ray&, real, real&)=0;
  39.   Vector getNormal(const Vector&) const;
  40.   virtual Vector normal(const Vector&) const =0;
  41.   virtual PolygonList* tesselate(const BoundingBox&)=0;
  42.  
  43.   virtual int setTransform(TransMatrix*);
  44.   TransMatrix* getTrans() const;
  45.   TransMatrix* getInvTrans() const;
  46.  
  47.   static long getIntersectionTests();
  48.   static long getIntersections();
  49.  
  50. protected:
  51.   TransMatrix* trans;
  52.   TransMatrix* itrans;
  53.   static long intersectionTests;
  54.   static long intersections;
  55. };
  56.  
  57. typedef GeoObject* GeoObjectPtr;
  58. declareList(GeoObjectList, GeoObjectPtr);
  59.  
  60. inline TransMatrix* GeoObject::getTrans() const {
  61.   return trans;
  62. }
  63.  
  64. inline TransMatrix* GeoObject::getInvTrans() const {
  65.   return itrans;
  66. }
  67.  
  68. inline long GeoObject::getIntersectionTests() {
  69.   return intersectionTests;
  70. }
  71.  
  72. inline long GeoObject::getIntersections() {
  73.   return intersections;
  74. }
  75.  
  76. #endif // GeoObject_H
  77.  
  78.