MCPcopy Create free account
hub / github.com/d3/d3-shape / round

Function round

test/arc-test.js:56–56  ·  view source on GitHub ↗
(x)

Source from the content-addressed store, hash-verified

54
55it("arc().centroid(…) computes the midpoint of the center line of the arc", () => {
56 const a = arc(), round = function(x) { return Math.round(x * 1e6) / 1e6; };
57 assert.deepStrictEqual(a.centroid({innerRadius: 0, outerRadius: 100, startAngle: 0, endAngle: Math.PI}).map(round), [50, 0]);
58 assert.deepStrictEqual(a.centroid({innerRadius: 0, outerRadius: 100, startAngle: 0, endAngle: Math.PI / 2}).map(round), [35.355339, -35.355339]);
59 assert.deepStrictEqual(a.centroid({innerRadius: 50, outerRadius: 100, startAngle: 0, endAngle: -Math.PI}).map(round), [-75, -0]);

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected