Skip to content
This repository was archived by the owner on Aug 26, 2025. It is now read-only.
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions rhill-voronoi-core.js
Original file line number Diff line number Diff line change
Expand Up @@ -1352,7 +1352,7 @@ Voronoi.prototype.clipEdge = function(edge, bbox) {
if (r>t1) {return false;}
if (r>t0) {t0=r;}
}
// bottom
// bottom
q = bbox.yb-ay;
if (dy===0 && q<0) {return false;}
r = q/dy;
Expand Down Expand Up @@ -1397,7 +1397,8 @@ Voronoi.prototype.clipEdge = function(edge, bbox) {
Voronoi.prototype.clipEdges = function(bbox) {
// connect all dangling edges to bounding box
// or get rid of them if it can't be done
var edges = this.edges,
var newEdges = [],
edges = this.edges,
iEdge = edges.length,
edge,
abs_fn = Math.abs;
Expand All @@ -1412,9 +1413,11 @@ Voronoi.prototype.clipEdges = function(bbox) {
!this.clipEdge(edge, bbox) ||
(abs_fn(edge.va.x-edge.vb.x)<1e-9 && abs_fn(edge.va.y-edge.vb.y)<1e-9)) {
edge.va = edge.vb = null;
edges.splice(iEdge,1);
} else {
newEdges.unshift(edge);
}
}
}
this.edges = newEdges;
};

// Close the cells.
Expand Down