Wouldn't it be just rotating the plane so that
the direction is North and comparing the new X coords.
rotd=: * [EMAIL PROTECTED]
comp=: j./&>
90 (rotd~ comp) _1 0;_1 0
0j_1 0j_1
90 (rotd~ comp) 2 1;1 _1
_1j2 1j1
0 (rotd~ comp) 2 1;1 _1
2j1 1j_1
180 (rotd~ comp) 2 1;1 _1
_2j_1 _1j1
left=: _. 0 1 {~ [: [EMAIL PROTECTED]/ [EMAIL PROTECTED]
left 90 (rotd~ comp) 2 1;1 _1
1
left 90 (rotd~ comp) _1 0;_1 0
_.
--- Brian Schott <[EMAIL PROTECTED]> wrote:
> Two objects in 2 dimensional space are facing the
> same direction, say D degrees. How does one determine which
> object is on the left if the positions of the two objects A
> and B in 2D, are given as A and B, for example as follows?
>
> 'A B' =: 2 1;1 _1
> D =: 90 NB. facing to the East
> result: A is on the left
>
> 'A B' =: _1 0;1 1
> D =: 0 NB. facing to the North
> result: A is on the left
>
> 'A B' =: _1 0;_1 0
> D =: 0 NB. facing to the North
> result: A is on the left and on the right (undecided?)
>
> How does one compute such results?
>
> (B=)
>
> Brian Schott
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm