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

Avoid full random #12

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Avoid full random #12

wants to merge 2 commits into from

Conversation

kmmndr
Copy link
Contributor

@kmmndr kmmndr commented May 27, 2015

Hi Daniel,

You may find here a pull request removing the full randomness to determine a good_ray.
I've added missing test for closed polygons.

The test is based on the following gist :
https://gist.github.com/PikachuEXE/71c6d0961e6bdc31846f
Thanks to @PikachuEXE :-)

@kmmndr
Copy link
Contributor Author

kmmndr commented May 27, 2015

Instead of exiting the loop, when MAX_SEED is reached, one could raise an exception

@kmmndr
Copy link
Contributor Author

kmmndr commented Jun 5, 2015

I'm sorry for the delay of my answer.
Instead of generating full random angles, the idea is to test opposed angles iteratively, trying to minimize good_ray duration.
I've added an exit from the loop to avoid blocking all the process if we aren't able to find a good ray, and 1000000 is just a large number.

@kmmndr
Copy link
Contributor Author

kmmndr commented Jun 5, 2015

As a polygon is 'closed', which means that even if the ray might be parallel to an edge, it will cross some other edges. Why do we need to test for ray not to be parallel to any edge ?

@kmmndr
Copy link
Contributor Author

kmmndr commented Jun 5, 2015

In fact, this PR is more an idea to test another approach.

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

Successfully merging this pull request may close these issues.

2 participants