MCPcopy
hub / github.com/plotly/plotly.js / convexPolygonArea

Function convexPolygonArea

test/jasmine/tests/funnelarea_test.js:24–38  ·  view source on GitHub ↗
(points)

Source from the content-addressed store, hash-verified

22var LEGEND_ENTRIES_SELECTOR = '.legendpoints path';
23
24function convexPolygonArea(points) {
25 var s1 = 0;
26 var s2 = 0;
27 var n = points.length;
28 for(var i = 0; i < n; i++) {
29 var k = (i + 1) % n;
30 var x0 = points[i][0];
31 var y0 = points[i][1];
32 var x1 = points[k][0];
33 var y1 = points[k][1];
34 s1 += x0 * y1;
35 s2 += x1 * y0;
36 }
37 return 0.5 * Math.abs(s1 - s2);
38}
39
40describe('Funnelarea defaults', function() {
41 function _supply(trace, layout) {

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…