473,480 Members | 2,269 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

If a given point in the plane lies inside, outside, or on the boundary of a polygon ?

1 New Member
Hello friend.
I want to write a program whether a given point in the plane lies inside, outside, or on the boundary of a polygon. I have found this interesting website which shows 2 ways of doing that. i.e InsidePolygon() and pnpoly()

http://local.wasp.uwa.edu.au/~pbourk...ry/insidepoly/

But these Algo/code don't detect if the input pt is on the boundary of a polygon?

Can you guys help me in that part of code/algo?

Your help is much appreciated.

~ Jenny
Sep 15 '10 #1
1 2468
newb16
687 Contributor
It requires to check is F(x,y)==0 for F describing a segment of the polygon, but as floating point calculations are imprecise, you will have to determine what precision is required and check abs(F(x,y)) < e instead.
it seems that relevand portion is
if (p1.x == p2.x || p.x <= xinters)
and you could use if (fabs(p.x-xinters)<epsilon) but this will not work on nearly horizontal segments.
Sep 15 '10 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

1
1341
by: A-PK | last post by:
Hi, How could I set the presence of the form to be called to be locked inside the boundary of the calling form ? I got A and B form A form contain tree view menu and B form was part of the...
8
2549
by: Piotre Ugrumov | last post by:
How can I implement a function that calculate the coordinates of a point, in 3 dimensional space? The function take 6 value (x, y, z, v(velocity), corner alfa, corner beta). The prototype is...
6
3632
BSOB
by: BSOB | last post by:
im gone for a long weekend so plenty of time for anyone to answer. if i have 4 points representing a polygon and each point is represented by an x and a y coordinate, is there an easy (or slightly...
4
4064
by: tbrown | last post by:
I have a listbox on my form and I set it to invisible. When a particular button on the form is pressed, I make the listbox visible and allow the user to select from it. When the selection occurs,...
1
8392
by: renu | last post by:
Hello, I have drawn polygon on window. And I want to check wheather given point is in that polygon region or not? How shold I find that? I have created object of class region GraphicsPath path...
4
11635
by: Uffe | last post by:
Is it possible to play a Flash Vide file (FLV) inside an VB.net application. (Example http://www.eurovision.tv/addons/mediaplayer/video/fin.flv ) I have succesfully done similar VB.net applications...
8
7495
by: SM | last post by:
I've always wonder if there is diference when declaring and initializing a varible inside/outside a loop. What's a better practice? Declaring and initializing variables inside a loop routine,...
10
9154
by: itrose | last post by:
Hi, Can anyone tell me how to recognize geometric shape using C#? I have geometric shapes like triangle, hexagon, pentagon, diamond, square,parallelogram, rectangle, etc. I have drawn all...
0
7051
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
6915
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7054
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7097
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
6750
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
6993
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
2993
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1307
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
193
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.