00001 // $Header: /nfs/slac/g/glast/ground/cvs/geometry/geometry/Ray.h,v 1.4 2001/09/21 18:37:19 atwood Exp $ 00002 #ifndef GEOMETRY_RAY_H 00003 #define GEOMETRY_RAY_H 00004 00005 #include "geometry/Point.h" 00006 #include <cfloat> // needed on NT for FLT_MAX 00007 00009 class Ray : public GeomObject 00010 { 00011 public: 00012 Ray( const Point& p, const Vector& d ); 00013 Ray( const Ray& r ); 00014 // constructor 00015 00017 virtual Point position( double s ) const ; 00019 const Point& position() const {return pos;} 00020 00022 virtual Vector direction( double ) const{ return dir; } 00024 const Vector& direction() const {return dir;} 00025 00027 GeomObject& transform( const CoordTransform & ); 00028 00030 virtual double curvature(double =0) const { return 0.0; } 00031 00033 virtual double step() const {return FLT_MAX;} 00034 00035 double getArcLength() const { return arclength; } 00036 void setArcLength( double s ) { arclength = s; } 00037 void setFlag( int k ) {flag = k;} 00038 int getFlag() const {return flag;} 00039 void addArcLength( double ds ) { arclength += ds; } 00040 // access to internal position 00041 00043 virtual double distanceOfClosestApproach(const Ray& r) const; 00044 virtual Vector vectorOfClosestApproach(const Ray& r) const; 00045 00046 const char *nameOf() const { return "Ray"; } 00047 virtual void printOn( std::ostream& os = std::cout ) const; 00048 00049 00050 protected: 00051 Point pos; // starting point 00052 Vector dir; // direction unit vector 00053 float arclength; // length along the Ray to be drawn 00054 int flag; // a flag to be used by clients 00055 00056 }; 00057 00058 #endif 00059
1.2.3 written by Dimitri van Heesch,
© 1997-2000