added operator [] and function Direction()
This commit is contained in:
parent
a61f6db8ac
commit
a53887e893
|
@ -89,6 +89,10 @@ public:
|
|||
inline const PointType &P1() const { return _p1; }
|
||||
inline PointType &P0() { return _p0; }
|
||||
inline PointType &P1() { return _p1; }
|
||||
|
||||
inline PointType &operator[] (const int i) {return i==0?_p0:_p1;}
|
||||
inline const PointType &operator[] (const int i) const {return i==0?_p0:_p1;}
|
||||
|
||||
/// The empty constructor
|
||||
Segment3() {};
|
||||
/// The (a,b) constructor
|
||||
|
@ -109,6 +113,8 @@ public:
|
|||
/// return the middle point
|
||||
inline PointType MidPoint( ) const
|
||||
{ return ( _p0 + _p1) / ScalarType(2.0) ; }
|
||||
inline PointType Direction( ) const
|
||||
{ return ( _p1 - _p0) ; }
|
||||
/// return the bounding box
|
||||
inline Box3<ScalarType> BBox( ) const
|
||||
{ Box3<ScalarType> t;
|
||||
|
|
Loading…
Reference in New Issue