Changed the interface of the interpolating function of a segment (2D and 3D) from the ambiguous P(float) to Lerp(float). Note that with the previous interface it could happen that seg.P(1) != seg.P0() just becouse seg.P(1) was the result of a lerp.

This commit is contained in:
Paolo Cignoni 2013-11-06 16:06:57 +00:00
parent c8ef412821
commit 3bdf666e86
2 changed files with 57 additions and 57 deletions

View File

@ -85,7 +85,7 @@ public:
{ _p0=a; _p1=b;} { _p0=a; _p1=b;}
/// calculates the point of parameter t on the segment. /// calculates the point of parameter t on the segment.
/// if t is in [0..1] returned point is inside the segment /// if t is in [0..1] returned point is inside the segment
inline PointType P( const ScalarType t ) const inline PointType Lerp( const ScalarType t ) const
{ return _p0 + (_p1 - _p0) * t; } { return _p0 + (_p1 - _p0) * t; }
/// return the middle point /// return the middle point
inline PointType MidPoint( ) const inline PointType MidPoint( ) const

View File

@ -108,7 +108,7 @@ public:
{ _p0=a; _p1=b;} { _p0=a; _p1=b;}
/// calculates the point of parameter t on the segment. /// calculates the point of parameter t on the segment.
/// if t is in [0..1] returned point is inside the segment /// if t is in [0..1] returned point is inside the segment
inline PointType P( const ScalarType t ) const inline PointType Lerp( const ScalarType t ) const
{ return _p0 + (_p1 - _p0) * t; } { return _p0 + (_p1 - _p0) * t; }
/// return the middle point /// return the middle point
inline PointType MidPoint( ) const inline PointType MidPoint( ) const