Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong algorithm implementation #1

Open
long-nguyen opened this issue Sep 16, 2014 · 0 comments
Open

Wrong algorithm implementation #1

long-nguyen opened this issue Sep 16, 2014 · 0 comments

Comments

@long-nguyen
Copy link

according to en.wikipedia.org/wiki/Even-odd_rule,
it should be:
if( (([[[polygon objectAtIndex:i] objectAtIndex:1] floatValue] > lat) != ([[[polygon objectAtIndex:j] objectAtIndex:1] floatValue] > lat)) && (lng < ( [[[polygon objectAtIndex:j] objectAtIndex:0] floatValue] - [[[polygon objectAtIndex:i] objectAtIndex:0] floatValue] ) * ( lat - [[[polygon objectAtIndex:i] objectAtIndex:1] floatValue] ) / ([[[polygon objectAtIndex:j] objectAtIndex:1] floatValue] - [[[polygon objectAtIndex:i] objectAtIndex:1] floatValue]) + [[[polygon objectAtIndex:i] objectAtIndex:0] floatValue] ) ){

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant