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

  1. /*
  2.  * Sphere.h - class definition for geometric object sphere.
  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 Sphere_H
  19. # define Sphere_H
  20.  
  21. #include "GeoObject.h"
  22. #include "Polygon.h"
  23.  
  24. //___________________________________________________________ Sphere
  25.  
  26. class Sphere : public GeoObject 
  27. {
  28. public:
  29.   static GeoObject* create(real, const Vector&);
  30.  
  31.   int intersect(const Ray&, real, real&);
  32.   Vector normal(const Vector&) const;
  33.   PolygonList* tesselate(const BoundingBox&);
  34.  
  35.   static PolygonList* tesselate(const Vector&, real, int);
  36.   static Vector computeSurfacePoint(real, real);
  37.  
  38. private:
  39.   Sphere(real, const Vector&);
  40.  
  41. private:
  42.   real r;         // radius
  43.   real rsqr;      // radius squared
  44.   Vector center;  // position
  45. };
  46.  
  47. #endif // Sphere_H
  48.