-
Notifications
You must be signed in to change notification settings - Fork 224
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
Fix point-in-polygon test and use a better test in polyhedron. #1577
Conversation
…ing to move it in some test cases.
…already contained in a flat polyhedron.
Nice how you could remove the The only point-in-polygon test I know is the one I'm not sure how Some randomized tests would be good, for both |
Yeah, I had this idea when I introduced that function call in the first place, but dropped it.
It's very simple, it projects the polygon and point onto the XY, XZ, or YZ planes and then essentially counts how often a line through the point crosses the polygons boundary. It's standard, I remember that I took it from somewhere. It's used mostly for ray / polygon intersection tests. Please don't replace it. It's fine for those cases. The problem here was twofold:
Some randomized tests would be good, for both polygonContainsPoint and Polyhedron::addPoint, but that can be done later, and it's some work to set up. If by randomized tests you mean "random for every test run", then I'm against it because tests must always be repeatable. If you mean "generated randomly and checked into source control for all eternity", then that may be doable. |
Agree, the tests must be repeatable. I was thinking of one of c++11's generators like |
Alright, yeah, that might work. But you'll need a test oracle. |
Issue: #1573