Using this idea:
*./"1 >/"2 p >:"1 (2 2)&$"1 cor
0 0 0 0 1 0 0 0 0
you get the form
find =: I.@:(*./"1)@:(>/"2)@:(>:"1) (2 2)&$"1
p find cor
4
This uses the representation that I normally use, where the bottom-right
corner is actually the point outside the rectangle (i. e.
bottomright =. topleft + heightwidth ). You could change the verb to
meet other representations.
Henry Rich
On 2/24/2013 2:54 AM, Gian Medri wrote:
Hi!
I have a matrix cor, where every row has the left upper and the right
bottom corner of a square.
cor
0 0 50 50
50 0 100 50
100 0 150 50
0 50 50 100
50 50 100 100
100 50 150 100
0 100 50 150
50 100 100 150
100 100 150 150
p=: 69 79
find=: 13 : '(*./"1 (x>"1 (2{."1 y))*.x< "1 (2}."1 y))# i. {.$y'
p find cor
4
I wonder if there is a more concise expression to find where the point p is.
Thanks
Gian Medri
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm