finding if point is inside irregular rectangle
- Posted by tone.skoda at siol.net Feb 25, 2002
- 461 views
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> Please view in a fixed-width font such as<BR> Courier.</FONT></DIV> <DIV> </DIV><FONT face=Arial size=2> <DIV><BR> |--<BR> | ----<BR> | ---<BR> | ----<BR> | ---<BR> | ----<BR> | -\<BR> | \\<BR> | \<BR> | \<BR> | \\<BR> | \<BR> | \<BR> | \\<BR> |------ \<BR> ----------- \<BR> ---------- \\<BR> ----------- \<BR> -----\<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> </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 is_point_in_irregular_rect (sequence point, sequence bounds)<BR> -- This is returned.<BR> integer is_point_in_rect<BR> -- TODO<BR> return ------=_NextPart_000_0064_01C1BE3A.1CBCA430--