MCPcopy Create free account
hub / github.com/microsoft/SandDance / signedArea

Function signedArea

docs/app/js/sanddance-app.js:104234–104241  ·  view source on GitHub ↗
(data, start, end, dim)

Source from the content-addressed store, hash-verified

104232 return polygonArea === 0 && trianglesArea === 0 ? 0 : Math.abs((trianglesArea - polygonArea) / polygonArea);
104233};
104234function signedArea(data, start, end, dim) {
104235 var sum = 0;
104236 for(var i = start, j = end - dim; i < end; i += dim){
104237 sum += (data[j] - data[i]) * (data[i + 1] + data[j + 1]);
104238 j = i;
104239 }
104240 return sum;
104241}
104242// turn a polygon in a multi-dimensional array form (e.g. as in GeoJSON) into a form Earcut accepts
104243earcut.flatten = function(data) {
104244 var dim = data[0][0].length, result = {

Callers 2

linkedListFunction · 0.70
sanddance-app.jsFile · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected