geometry.cpp
changeset 835 31841b366d5e
parent 824 36eb4b8f409e
     1.1 --- a/geometry.cpp	Wed Mar 10 15:36:19 2010 +0000
     1.2 +++ b/geometry.cpp	Mon Mar 15 11:49:42 2010 +0000
     1.3 @@ -65,10 +65,18 @@
     1.4  {
     1.5  }
     1.6  
     1.7 +//! Check if length is 0
     1.8 +bool Vector::isNull()
     1.9 +{
    1.10 +	if (x()==0 && y()==0)
    1.11 +		return true;
    1.12 +	return false;	
    1.13 +}
    1.14 +
    1.15  //! Normalize vector
    1.16  void Vector::normalize ()
    1.17  {
    1.18 -	if (x()==0 && y()==0) return;
    1.19 +	if (isNull() ) return;
    1.20  	qreal l=sqrt ( x()*x() + y()*y() );
    1.21  	setX (x()/l);
    1.22  	setY (y()/l);