Re: [PATCH 04/20] dix: fix comment, directions flagged are 45°

Simon Thum simon.thum at gmx.de
Wed Apr 20 14:02:49 PDT 2011


On 04/20/2011 08:28 AM, Peter Hutterer wrote:
> The two directions returned by this calculation are always the two boundary
> conditions. Since we don't do quadrants but octants, the flagged ones are
> 45°, not 90°. e.g. an angle of 35° flags E and NE.
> 
Yes, so 2 flagged directions cover an angle of 90 degrees. I agree the
wording can be improved, but I'd rather do "45 degree each" or something
like it.

Cheers,

Simon

> Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
> ---
>  dix/ptrveloc.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/dix/ptrveloc.c b/dix/ptrveloc.c
> index e95ccbe..50ad22a 100644
> --- a/dix/ptrveloc.c
> +++ b/dix/ptrveloc.c
> @@ -486,7 +486,7 @@ DoGetDirection(int dx, int dy){
>      /* find direction. We avoid r to become negative,
>       * since C has no well-defined modulo for such cases. */
>      r = (r+(M_PI*2.5))/(M_PI/4);
> -    /* this intends to flag 2 directions (90 degrees),
> +    /* this intends to flag 2 directions (45 degrees),
>       * except on very well-aligned mickeys. */
>      i1 = (int)(r+0.1) % 8;
>      i2 = (int)(r+0.9) % 8;



More information about the xorg-devel mailing list