00001
00002
00003 #ifndef LHCBMATH_LINE_H
00004 #define LHCBMATH_LINE_H 1
00005
00006
00007
00008 #include <iostream>
00009
00010 namespace Gaudi
00011 {
00012 namespace Math
00013 {
00014
00015
00037 template<typename aPoint, typename aVector>
00038 class Line
00039 {
00040 public:
00041 typedef aPoint Point;
00042 typedef aVector Vector;
00043 public:
00045 Line() {}
00047 Line ( const aPoint& p0 , const aVector& v0 ) : m_p0 ( p0 ) , m_v0 ( v0 ) {}
00049 Line ( const aPoint& p0 , const aPoint& p1 ) : m_p0 ( p0 ) , m_v0 ( p1 - p0 ) {}
00051 const aPoint& beginPoint() const { return m_p0 ; }
00053 const aVector& direction() const { return m_v0 ; }
00059 aPoint position ( const double mu ) const
00060 { return beginPoint() + direction() * mu ; }
00066 aPoint operator() ( const double mu ) const
00067 { return beginPoint() + direction() * mu ; }
00068 public:
00069 inline std::ostream& fillStream ( std::ostream& os ) const
00070 {
00071 os << "\np0 ("
00072 << m_p0.x() << " " << m_p0.y() << " " << m_p0.z()
00073 << ") direction ("
00074 << m_v0.x()<< " " << m_v0.y() << " " << m_v0.z() << ")\n"
00075 << std::endl;
00076 return os;
00077 }
00078 private:
00080 aPoint m_p0;
00082 aVector m_v0;
00083 };
00084
00085
00086 }
00087
00088
00089 }
00090
00091
00092 template<typename aPoint, typename aVector>
00093 inline std::ostream& operator<<
00094 (std::ostream& os ,
00095 const Gaudi::Math::Line<aPoint,aVector>& rhs )
00096 {
00097 return rhs.fillStream(os);
00098 }
00099
00100
00101
00102 #endif // LHCBMATH_LINE_H
00103
00104