comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: Finding a points inside polygon
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: Finding a points inside polygon [message #32630 is a reply to message #32629] Thu, 24 October 2002 07:47 Go to previous messageGo to previous message
James Kuyper is currently offline  James Kuyper
Messages: 425
Registered: March 2000
Senior Member
Gunho Sohn wrote:
>
> Dear All,
>
> I have a problem to determine whether a point (x,y) is inside the polygon.
> Simply I've used IDLanROI::ContainsPoints method in my code. However, it
> seems to make a serious problem. Please, check this problem together. I used
> following polygons and point
>
> polygon vertices (vx,vy):
> vx=[35.859278 55.591451 155.00000 155.00000]
> vy=[0.00000000 0.00000000 19.279154 23.105984]
>
> point (x,y):
> x=122.87897 y=13.049367
>
> When I simply coded this as follows, it printes as 0 which means this point
> is located outside of polygon. But, it is not!

IDL> vx = [35.859278, 55.591451, 155.00000, 155.00000, 35.859278]
IDL> vy = [0.00000000, 0.00000000, 19.279154, 23.105984, 0.000000]

I added the extra point on the end, to close the polygon. ContainsPoint
doesn't need that closure, but the follow commands do:

IDL> plot,vx,vy
IDL> plots,[122.87897],[13.049367]

That's ambiguous - the point seems to be right on the edge.

IDL> plot,vx,vy,xrange=[122,123],yrange=[13,14]
IDL> plots,[122.87897],[13.049367],psym=1

That doesn't help; it's still ambiguous.

IDL> plot,vx,vy,xrange=[122.87,122.88],yrange=[13.04,13.05]
IDL> plots,[122.87897],[13.049367]

Finally! That looks to me like the point is slightly, but definitely,
outside of the polygon. ContainsPoint is apparantly correct.
[Message index]
 
Read Message
Read Message
Read Message
Previous Topic: IDL --> C++ ?
Next Topic: Map_Set and Sat_P

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 22:26:40 PDT 2025

Total time taken to generate the page: 1.12066 seconds