finding if point is inside irregular rectangle

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

This is a multi-part message in MIME format.

------=_NextPart_000_0064_01C1BE3A.1CBCA430
	charset="iso-8859-2"

Here's another problem: I need to find out if point lies inside
an irregular rectangle. Irregular rectangle has
4 corners but they don't need to be 90 degree, although they can still be.

Example of irregular rectangle:

     Please view in a fixed-width font such as
                    Courier.


         |--
         |  ----
        |       ---
        |          ----
       |               ---
       |                  ----
      |                       -\
      |                         \\
      |                           \
     |                             \
     |                              \\
    |                                 \
    |                                  \
   |                                    \\
   |------                                \
          -----------                      \
                     ----------             \\
                               -----------    \
                                          -----\


Below is function which needs to be finished. I would do it myself but I'm not
too good at math.

-- bounds parameter should define 4 points of rectangle and should have these
members:
-- 1,2: left_top_x, left_top_y,
-- 3,4: left_bottom_x, left_bottom_y,
-- 5,6: right_top_x, right_top_y,
-- 7,8: right_bottom_x, right_bottom_y.
function is_point_in_irregular_rect (sequence point, sequence bounds)
    -- This is returned.
    integer is_point_in_rect
    -- TODO
    return is_point_in_rect
end function

------=_NextPart_000_0064_01C1BE3A.1CBCA430
Content-Type: text/html;
	charset="iso-8859-2"
Content-Transfer-Encoding: 8bit

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-2">
<META content="MSHTML 5.50.4522.1800" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT face=Arial size=2>
<DIV><FONT face=Arial size=2>Here's another problem: </FONT><FONT face=Arial 
size=2>I need to find out if point lies inside<BR>an irregular rectangle. 
Irregular rectangle has<BR>4 corners but they don't need to be 90 degree, 
although they can still be.</FONT></DIV>
<DIV><FONT face=Arial size=2><BR>Example of irregular 
rectangle:<BR><BR>&nbsp;&nbsp;&nbsp;&nbsp; Please view in a fixed-width font 
such 
as<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb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&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
-----------&nbsp;&nbsp;&nbsp; 
\<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
-----\<BR><BR></DIV>
<DIV><FONT face=Arial size=2>Below is function which needs to be finished. I 
would do it myself but I'm not too good at math.</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV>-- bounds parameter should define 4 points of rectangle and should have 
these members:</DIV>
<DIV>-- 1,2: left_top_x, left_top_y,<BR>-- 3,4: left_bottom_x, 
left_bottom_y,<BR>-- 5,6: right_top_x, right_top_y,<BR>-- 7,8: right_bottom_x, 
right_bottom_y.<BR>function&nbsp;is_point_in_irregular_rect (sequence 
point,&nbsp;sequence bounds)<BR>&nbsp;&nbsp;&nbsp;&nbsp;-- This is 
returned.<BR>&nbsp;&nbsp;&nbsp; integer 
is_point_in_rect<BR>&nbsp;&nbsp;&nbsp;&nbsp;-- TODO<BR>&nbsp;&nbsp;&nbsp; return

------=_NextPart_000_0064_01C1BE3A.1CBCA430--

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

Search



Quick Links

User menu

Not signed in.

Misc Menu