Re: sorting points or rectangles

new topic     » goto parent     » topic index » view thread      » older message » newer message

Haven't tested it out, but in principle this seems reasonable,
IF THE AXES OF THE RECTANGLES ARE PARALLEL!:


-- for rectangles each defined by 4 corner points in this order:
-- left-upper xy, right-upper xy, right-lower xy, left-lower xy:
--  {{lux,luy}, {rux, ruy}, {rlx,rly},{llx,lly}}
function IsInside(sequence OuterRectangle, sequence PossibleInnerRectangle)

     if OuterRectangle[1][1] < PossibleInnerRectangle[1][1] and  -- left
upper x outside
        OuterRectangle[1][2] < PossibleInnerRectangle[1][2] and  -- left
upper y outside

        OuterRectangle[3][1] > PossibleInnerRectangle[3][1] and  -- right
lower x outside
        OuterRectangle[3][2] > PossibleInnerRectangle[3][2] and  -- right
lower y outside

        then return 1 -- for true
        else return 0 -- for false
     end if
end function

Dan Moyer



----- Original Message -----
From: <tone.skoda at siol.net>
To: "EUforum" <EUforum at topica.com>
Sent: Wednesday, February 20, 2002 2:33 PM
Subject: sorting points or rectangles



does anybody have any idea how could i sort rectangles or points, same
problem.
i need it sorted so that when i have a lot of rectangles, i can quickly get
the ones which are inside some given big
rectangle.

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu