Main Page   Class Hierarchy   Compound List   File List   Compound Members   File Members  

Surface.h

Go to the documentation of this file.
00001 // $Id: Surface.h,v 1.2 2000/01/18 00:42:09 burnett Exp $
00002 //
00003 //
00004 
00005 #ifndef GEOMETRY_SURFACE_H
00006 #define GEOMETRY_SURFACE_H
00007 
00008 #include "geometry/Point.h"
00009 #include <float.h> // for FLT_MAX on NT
00019 class Surface : public GeomObject
00020 {
00021 
00022  public:
00023  
00025     virtual int inside(const Point& p)const{ return ( how_near( p ) >= 0 ); }
00026 
00027 
00033     virtual double how_near( const Point& x ) const=0;
00034 
00035  
00037     virtual double distance( const Point& x, const Vector& v, int inout)const=0;
00038 
00040     virtual Vector normal( const Point& x )const=0;
00041 
00043 
00046     virtual GeomObject& transform(const CoordTransform& T );
00047 
00049     virtual void reverse();
00050 
00052     const Point& origin()const{return referencePoint;}
00053 
00055     const Vector& direction() const { return referenceDirection; }
00056 
00057   
00059     virtual Surface& copy()const;
00060 
00064     virtual void setOffset(double){};
00065     virtual double offset()const{return FLT_MAX;};
00066 
00067 
00068  protected:
00069     Surface( const Point& o, const Vector& n )
00070         : referencePoint( o ), referenceDirection(n) 
00071     {}
00072     // only subclasses can implement
00073 
00074     Surface(const Surface&);
00075     // copy constructor not accessible
00076 
00077  
00078  private:
00079 
00080     const Point& referencePoint;  
00081     // reference point to use: defined elsewhere
00082   
00083     Vector referenceDirection;    
00084     // direction: normal for a plane surface, axis  for cylinder
00085 
00086 
00087 };
00088 //---------------------------------------------------------------------
00089 //                 inlines
00090 //---------------------------------------------------------------------
00091 
00092 inline std::ostream& operator<<( std::ostream& os, const Surface& s )
00093   { s.printOn(os); return os;}
00094 
00095 inline std::ostream& operator<<( std::ostream& os, const Surface* s )
00096   { s->printOn(os); return os;}
00097 
00098 #endif
00099 

Generated at Wed Nov 21 12:20:12 2001 by doxygen1.2.3 written by Dimitri van Heesch, © 1997-2000