Loading include/math/vector2d.h +50 −46 Original line number Diff line number Diff line Loading @@ -65,8 +65,8 @@ std::ostream& operator<<( std::ostream& stream, const VECTOR2<T>& vector ); * Class VECTOR2 * defines a general 2D-vector/point. * * This class uses templates to be universal. Several operators are provided to help easy implementing * of linear algebra equations. * This class uses templates to be universal. Several operators are provided to help * easy implementing of linear algebra equations. * */ template <class T = int> Loading Loading @@ -153,7 +153,8 @@ public: * the side of the line at which we are (negative = left) * @return the distance */ T LineDistance( const VECTOR2<T>& aStart, const VECTOR2<T>& aEnd, bool aDetermineSide = false ) const; T LineDistance( const VECTOR2<T>& aStart, const VECTOR2<T>& aEnd, bool aDetermineSide = false ) const; /** * Function ClosestSegmentPoint Loading Loading @@ -368,7 +369,8 @@ VECTOR2<T> VECTOR2<T>::LineProjection( const VECTOR2<T>& aA, const VECTOR2<T>& a template <class T> T VECTOR2<T>::LineDistance( const VECTOR2<T>& aStart, const VECTOR2<T>& aEnd, bool aDetermineSide ) const T VECTOR2<T>::LineDistance( const VECTOR2<T>& aStart, const VECTOR2<T>& aEnd, bool aDetermineSide ) const { extended_type a = aStart.y - aEnd.y; extended_type b = aEnd.x - aStart.x; Loading @@ -380,7 +382,8 @@ T VECTOR2<T>::LineDistance( const VECTOR2<T>& aStart, const VECTOR2<T>& aEnd, bo template <class T> VECTOR2<T> VECTOR2<T>::ClosestSegmentPoint( const VECTOR2<T>& aStart, const VECTOR2<T>& aEnd ) const VECTOR2<T> VECTOR2<T>::ClosestSegmentPoint( const VECTOR2<T>& aStart, const VECTOR2<T>& aEnd ) const { VECTOR2<T> d = (aEnd - aStart); extended_type l_squared = (extended_type) d.x * d.x + (extended_type) d.y * d.y; Loading Loading @@ -612,6 +615,7 @@ std::ostream& operator<<( std::ostream& aStream, const VECTOR2<T>& aVector ) return aStream; } /* Default specializations */ typedef VECTOR2<double> VECTOR2D; typedef VECTOR2<int> VECTOR2I; Loading Loading
include/math/vector2d.h +50 −46 Original line number Diff line number Diff line Loading @@ -65,8 +65,8 @@ std::ostream& operator<<( std::ostream& stream, const VECTOR2<T>& vector ); * Class VECTOR2 * defines a general 2D-vector/point. * * This class uses templates to be universal. Several operators are provided to help easy implementing * of linear algebra equations. * This class uses templates to be universal. Several operators are provided to help * easy implementing of linear algebra equations. * */ template <class T = int> Loading Loading @@ -153,7 +153,8 @@ public: * the side of the line at which we are (negative = left) * @return the distance */ T LineDistance( const VECTOR2<T>& aStart, const VECTOR2<T>& aEnd, bool aDetermineSide = false ) const; T LineDistance( const VECTOR2<T>& aStart, const VECTOR2<T>& aEnd, bool aDetermineSide = false ) const; /** * Function ClosestSegmentPoint Loading Loading @@ -368,7 +369,8 @@ VECTOR2<T> VECTOR2<T>::LineProjection( const VECTOR2<T>& aA, const VECTOR2<T>& a template <class T> T VECTOR2<T>::LineDistance( const VECTOR2<T>& aStart, const VECTOR2<T>& aEnd, bool aDetermineSide ) const T VECTOR2<T>::LineDistance( const VECTOR2<T>& aStart, const VECTOR2<T>& aEnd, bool aDetermineSide ) const { extended_type a = aStart.y - aEnd.y; extended_type b = aEnd.x - aStart.x; Loading @@ -380,7 +382,8 @@ T VECTOR2<T>::LineDistance( const VECTOR2<T>& aStart, const VECTOR2<T>& aEnd, bo template <class T> VECTOR2<T> VECTOR2<T>::ClosestSegmentPoint( const VECTOR2<T>& aStart, const VECTOR2<T>& aEnd ) const VECTOR2<T> VECTOR2<T>::ClosestSegmentPoint( const VECTOR2<T>& aStart, const VECTOR2<T>& aEnd ) const { VECTOR2<T> d = (aEnd - aStart); extended_type l_squared = (extended_type) d.x * d.x + (extended_type) d.y * d.y; Loading Loading @@ -612,6 +615,7 @@ std::ostream& operator<<( std::ostream& aStream, const VECTOR2<T>& aVector ) return aStream; } /* Default specializations */ typedef VECTOR2<double> VECTOR2D; typedef VECTOR2<int> VECTOR2I; Loading