Comments (11)
I like your idea of returning the neighbouring cells, makes complete sense. However regarding the random neighbour feature, this strikes me as too much of application-specific, not a "natural" feature, so I will remove this one after the merge.
from javascript-voronoi.
Makes perfect sense; it was easy enough to implement inside or outside of the library.
from javascript-voronoi.
Ok I finally merged your GetNeighbourIDs(), but I mistakenly merged everything else which I did not want until I understand well what you propose. I also like your idea of finding which Voronoi cell is under a specific vertex, except I want to look more closely at your implementation.
from javascript-voronoi.
Re "Unsure what to do on corners/edges which could be in 2 or more cells":
Well, we are dealing with mathematical objects here: points have no dimension, lines have no thickness, so there is really no issue. My concern is how to lookup efficiently a cell given a point. I need to give some more thoughts to this.
from javascript-voronoi.
ok, so it looks like I screwed up my commits and you might have gotten
caught between them.
The first one added 2 new functions- getNeighborIDs and getRandomNeighborID
- you wanted to get rid of getRandomNeighborID.
The second commit (which we haven't discussed) was adding the ability to
track corners- I accidentally pushed this and it got caught in the mix and
half implemented.
Beyond that, I had a feature request to find a cell when provided
coordinates, however I have no clue on how to implement that.
Sorry for the confusion.
On Tue, Jan 22, 2013 at 1:23 PM, Raymond Hill [email protected]:
Re "Unsure what to do on corners/edges which could be in 2 or more cells":
Well, we are dealing with mathematical objects here: points have no
dimension, lines have no thickness, so there is really no issue. My concern
is how to lookup efficiently a cell given a point. I need to give some more
thoughts to this.—
Reply to this email directly or view it on GitHubhttps://github.com//issues/2#issuecomment-12558357.
from javascript-voronoi.
I looked a bit further and I will implement your idea of "cell at point" idea, it makes good sense to be part of the interface. The way I see it now it is a straightforward binary search, which I can easily implement by not throwing away the sorted array of sites I use in the main Fortune loop. (so there is zero cost on performance.)
from javascript-voronoi.
that's excellent news! I can't wait to give it a try.
On Tue, Jan 22, 2013 at 5:39 PM, Raymond Hill [email protected]:
I looked a bit further and I will implement your idea of "cell at point"
idea, it makes good sense to be part of the interface. The way I see it now
it is a straightforward binary search, which I can easily implement by not
throwing away the sorted array of sites I use in the main Fortune loop. (so
there is zero cost on performance.)—
Reply to this email directly or view it on GitHubhttps://github.com//issues/2#issuecomment-12571056.
from javascript-voronoi.
Hmm, it will take a bit longer to do, it is not as straightforward as I naively thought first. I don't think I will have time to do it before the end of next week, at least this will give me time to ponder the best way to implement this.
from javascript-voronoi.
OK. Let me know if I can be of any help.
On Jan 23, 2013 8:08 PM, "Raymond Hill" [email protected] wrote:
Hmm, it will take a bit longer to do, it is not as straightforward as I
naively thought first. I don't think I will have time to do it before the
end of next week, at least this will give me time to ponder the best way to
implement this.—
Reply to this email directly or view it on GitHubhttps://github.com//issues/2#issuecomment-12632167.
from javascript-voronoi.
The naive thinking was to think that a unidimensional data structure would allow me to efficiently lookup two-dimensional elements. Nonsense. For efficiency, need a quadtree data structure. And there happens to be one implementation in JS there: https://github.com/mikechambers/ExamplesByMesh/tree/master/JavaScript/QuadTree and a great demo of it there: http://www.mikechambers.com/blog/2011/03/21/javascript-quadtree-implementation/
from javascript-voronoi.
Ok, on second thought, I rather have the user himself implement, or preferably reuse whatever implementation of quadtree (or treemap) is available out there. I wrote a demo reusing one implementation from Mike Chambers (https://github.com/mikechambers/ExamplesByMesh/tree/master/JavaScript/QuadTree ), so that a user can have an idea how to proceed:
http://www.raymondhill.net/voronoi/rhill-voronoi-demo4.php
So whatever new quadtree or whatever treemap implementation comes along, a user will be free to choose whatever suits him best, rather than have one specific implementation, which might not be suitable for all cases, hard-coded in this project.
from javascript-voronoi.
Related Issues (20)
- Voronoi Result missing an edge? HOT 3
- Feature request : get all adjacent vertices for a given vertex HOT 5
- Duplicate vertices on bounding box HOT 6
- Feature request: segment as site HOT 1
- publish to npm HOT 2
- main branch version tag is missing HOT 1
- Get Cell vertices ordered clockwise or counter clockwise HOT 2
- closeCells() fails with "this makes no sense!" exception HOT 2
- point intersection fails with some cells due to 0 length edges HOT 1
- No edge or halfedges are created HOT 4
- How could I get the center point in the polygon?
- Add ``Point`` as a public object in documentation HOT 2
- ES2017 HOT 1
- Can't directly deal with Northern Hemisphere latitudes HOT 1
- Site Cell missmatch? HOT 3
- How would one check if a point is within a given cell?
- mixing text and floats can cause wrong operations on user's code HOT 8
- Uncaught TypeError: Cannot read property 'rbRed' of null (line 316)
- Readme uses incorrect order for compute()
- Tip: You can pass through extra data with your sites coords, that is then in cells sites output. HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from javascript-voronoi.