[Rock-dev] base::Angle

Janosch Machowinski Janosch.Machowinski at dfki.de
Fri Apr 12 12:13:58 CEST 2013


And another interesting question :
Angle start(0);
Angle end(2*M_PI)

Angle foo(M_PI);
foo.isInRange(start,end);

returns the same as :
Angle start(0);
Angle end(0)

Angle foo(M_PI);
foo.isInRange(start,end);

How to fix this ?
Greetings
     Janosch

On 12.04.2013 11:48, Janosch Machowinski wrote:
> Hey,
> I want to extend base::Angle by two methods but I am not
> sure about the naming of the methods.
>
> One would be :
>       /**
>        * Inverts the current angle
>        * */
>       inline Angle &invert()
>       {
>           if(rad < 0)
>               rad += M_PI;
>           else
>               rad -=M_PI;
>           return *this;
>       }
>
>
> The other would be :
>       Angle operator-()
>       {
>           rad = -rad;
>       }
>
> Is this an correct intuitive naming scheme ?
> Better ideas ?
> Greetings
>       Janosch
>
>
> _______________________________________________
> Rock-dev mailing list
> Rock-dev at dfki.de
> http://www.dfki.de/mailman/cgi-bin/listinfo/rock-dev



More information about the Rock-dev mailing list