Skip to content
This repository was archived by the owner on Nov 4, 2020. It is now read-only.

Add failing tests to try to confirm a suspected bug#1

Merged
tidwall merged 1 commit into
tidwall:masterfrom
drewlesueur:failing_tests
Dec 4, 2016
Merged

Add failing tests to try to confirm a suspected bug#1
tidwall merged 1 commit into
tidwall:masterfrom
drewlesueur:failing_tests

Conversation

@drewlesueur
Copy link
Copy Markdown

@drewlesueur drewlesueur commented Dec 4, 2016

(Hopefully this is helpful)
I added some tests that I think should pass and some of them end up failing.

I tried to actually fix the issue. I got some test to pass, but I ended up breaking other tests, so I removed my attempt to fix.
My attempt was related to this code I found here: https://rosettacode.org/wiki/Ray-casting_algorithm#Go

for p.y == a.y || p.y == b.y {
        p.y = math.Nextafter(p.y, math.Inf(1))
}

I am not very familiar with the algorithm though.

PS, Thanks for the code. Tile38 looks really interesting.

@tidwall tidwall merged commit 93485be into tidwall:master Dec 4, 2016
tidwall added a commit that referenced this pull request Dec 4, 2016
@tidwall
Copy link
Copy Markdown
Owner

tidwall commented Dec 4, 2016

Hi Drew,

Thanks a bunch for finding this bug. Sorry about my broken code. :(

Typically a raycast can only help to determine if a point is fully inside a polygon, but I need to also detect if a point is on a segment of a polygon. I made some modification based on your suggested code. It's likely a little slower than the previous, but it should work now.

Please test it out on your side and let me know what you think.

@drewlesueur
Copy link
Copy Markdown
Author

Thank you!
This also fixes my real-world test on my side.

@tidwall
Copy link
Copy Markdown
Owner

tidwall commented Dec 4, 2016

That's great to hear. 👍

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants