MCPcopy Create free account
hub / github.com/breck7/scroll / render

Method render

external/.d3.js:7618–7644  ·  view source on GitHub ↗
(context)

Source from the content-addressed store, hash-verified

7616 }
7617 }
7618 render(context) {
7619 const buffer = context == null ? context = new Path : undefined;
7620 const {delaunay: {halfedges, inedges, hull}, circumcenters, vectors} = this;
7621 if (hull.length <= 1) return null;
7622 for (let i = 0, n = halfedges.length; i < n; ++i) {
7623 const j = halfedges[i];
7624 if (j < i) continue;
7625 const ti = Math.floor(i / 3) * 2;
7626 const tj = Math.floor(j / 3) * 2;
7627 const xi = circumcenters[ti];
7628 const yi = circumcenters[ti + 1];
7629 const xj = circumcenters[tj];
7630 const yj = circumcenters[tj + 1];
7631 this._renderSegment(xi, yi, xj, yj, context);
7632 }
7633 let h0, h1 = hull[hull.length - 1];
7634 for (let i = 0; i < hull.length; ++i) {
7635 h0 = h1, h1 = hull[i];
7636 const t = Math.floor(inedges[h1] / 3) * 2;
7637 const x = circumcenters[t];
7638 const y = circumcenters[t + 1];
7639 const v = h0 * 4;
7640 const p = this._project(x, y, vectors[v + 2], vectors[v + 3]);
7641 if (p) this._renderSegment(x, y, p[0], p[1], context);
7642 }
7643 return buffer && buffer.value();
7644 }
7645 renderBounds(context) {
7646 const buffer = context == null ? context = new Path : undefined;
7647 context.rect(this.xmin, this.ymin, this.xmax - this.xmin, this.ymax - this.ymin);

Callers

nothing calls this directly

Calls 3

_renderSegmentMethod · 0.95
_projectMethod · 0.95
valueMethod · 0.45

Tested by

no test coverage detected