在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称:gorhill/Javascript-Voronoi开源软件地址:https://github.com/gorhill/Javascript-Voronoi开源编程语言:JavaScript 54.4%开源软件介绍:Javascript-VoronoiA Javascript implementation of Steven J. Fortune's algorithm to efficiently compute Voronoi diagrams. The Voronoi object's purpose is to solely compute a Voronoi diagram, it is completely standalone, with no dependency on external code: it contains no rendering code: that is left to the user of the library. Core files
Where the Voronoi object is implemented. This is a standalone library, there is no dependency.
The minimized version (using YUI compressor) Demo files
Demo pages to demonstrate usage of the Voronoi object.
Used by demo pages. ExplorerCanvas, giving pre-HTML5 Internet Explorer the ability to make sense of HTML5's canvas element. Pulled from http://code.google.com/p/explorercanvas/
Used by rhill-voronoi-demo3.php
Main object: VoronoiA Javascript object which allows to compute a Voronoi diagram. The Voronoi object doesn't render the resulting Voronoi diagram, the user is responsible for rendering the diagram. UsageRoughly: var voronoi = new Voronoi();
var bbox = {xl: 0, xr: 800, yt: 0, yb: 600}; // xl is x-left, xr is x-right, yt is y-top, and yb is y-bottom
var sites = [ {x: 200, y: 200}, {x: 50, y: 250}, {x: 400, y: 100} /* , ... */ ];
// a 'vertex' is an object exhibiting 'x' and 'y' properties. The
// Voronoi object will add a unique 'voronoiId' property to all
// sites. The 'voronoiId' can be used as a key to lookup the associated cell
// in diagram.cells.
var diagram = voronoi.compute(sites, bbox); The returned 'diagram' variable is a Javascript object with the following properties:
An array of unordered, unique
An array of unordered, unique
An array of
The time it took to compute the Voronoi diagram, in milliseconds. Added on October 12, 2013: In order to help improve performance,
var diagram;
...
// some kind of loop starting here (whether outright or through a timer)
...
voronoi.recycle(diagram);
// diagram.vertices, diagram.edges and diagram.cells can no longer be used!
diagram = voronoi.compute(sites, bbox);
// do stuff with content of `diagram`
... This new method helps performance significantly when re-computing a Voronoi diagram, as it saves on memory allocation, and associated garbage collection. Public objects
The
LicenseCopyright (c) 2010-2013 Raymond Hill https://github.com/gorhill/Javascript-Voronoi Licensed under The MIT License http://en.wikipedia.org/wiki/MIT_License Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论