-
Notifications
You must be signed in to change notification settings - Fork 14
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
repeatable results? #2
Comments
See Kcnarf/d3-voronoi-treemap#4. I'm working on a pull request to fix this. |
@Fil: I see you use the 'pie' initial position, which actually removes the randomness at initilization. It works fine when there is no too much data. In your use case, it doesn't produce the same arrangement because during the iterative process producing the final arrangement, some of your data (the lightest) are completely overweighted (they are too close to other heavier cells, and they are assigned an empty area). In such a case, the algorithm randomly choose a new position where such cell still exists. This is why you get different Voronoï maps when reloading. The PR from @michaschwab is the solution: re-positioning of overweighted cells will become repeatable. It is orthogonal to the 'pie' initial positioning, and both codes will perfectly work together. Nevertheless, the doc of the 'pie' initial positioning have to be updated. I will not be able to work on @michaschwab's PR before next week (from 13th aug. 2018). |
After some googling, I found another way to make a repeatable Voronoï map with the help of seedrandom. As the @michaschwab's PR does, it defines a PRNG. It may be used to replace/overwrite Seedrandom can also be used without overwriting |
The new version 1.2.0 of the d3-voronoi-map plugin now provides a new 'prng' API. It allows to define a prng. If this one is seeded, then randomness becomes repeatable, leading to repeatable outputs/arrangements. You can see it in action in https://beta.observablehq.com/@kcnarf/repeatable-voronoi-weighted-maps (focus on https://beta.observablehq.com/@kcnarf/repeatable-voronoi-weighted-maps#voronoiMap). Indeed, the initial 'pie' positioning is no longer required for the sake of repeatability. |
I don't think there is any random element in the following observable
https://beta.observablehq.com/@fil/voronoi-weighted-maps
yet the results vary between runs.
The text was updated successfully, but these errors were encountered: