just check the signs of the i, j components of vector from the centre of
screen to (x,y)

pseudo code:-
getQuadrant(x,y){
   string Q[]={"1st","4th","2nd", "3rd"};
   vx=(x>=midx)?0:1
   vy=(y>=midy)?0:1
   return Q[(vx<<1)|vy]
}

Anurag Sharma


On Mon, Jun 14, 2010 at 5:55 PM, siddharth srivastava
<[email protected]>wrote:

> I have this code snippet:
> This code snippet defines a boundary coordinates on the screen wrt to the
> center(of the screen).
>
>     if( x < x_center )
>         x_border = x_center - x_shift;
>     else
>         x_border = x_center + x_shift;
>
>     if( y < y_center )
>         y_border = y_center - y_shift;
>     else
>         y_border = y_center + y_shift;
>
> //x_shift and y_shift are constants.
>
> What is the best possible way to determine in which quadrant( wrt to the
> center) the point (x,y) lies ?
>
>
> Siddharth Srivastava
>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected]<algogeeks%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.

Reply via email to