Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Why do polygon coords need to be in correct order? #5

Closed
drale2k opened this Issue · 4 comments

2 participants

@drale2k

Hello.

First, this lib is just awesome and i wanna thank you for creating and sharing it!

Now my question, why do coords of the polygon in isPointInside do need to be in the correct order? The reason why i ask is because if i make some points on a piece of paper, there is only one way i can connect the points without a line crossing an other line.

Do they have to be in correct order because the way you wrote the function or do i oversee something and it is technically not possible? I completly understand that it might be much more work and you don`t want or have no time to do it, i am just curious.

Thanks!

@manuelbieh
Owner

Hi,

thank you for your feedback!

Maybe you can understand it better when you have a look at the following image:
ispointinside

The red dot (your "position") and all other spots are exactly at the same position in both images. Only the order of the coordinates differs. In version 1 your spot is not inside the polygon, in version 2 it is.

@drale2k

Ok i see it now, hm i have a feeling that there is some solution for this. I will post it if i figure it out! ;O

Thanks

@manuelbieh
Owner

Save your time. You're trying to find a solution for a problem which does not exist. It of course always matters in which order your spots are. In case 1 your position is just not within the polygon and that's totally fine.

@drale2k

OK you are absolutely right, thanks

@manuelbieh manuelbieh closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.