MCPcopy Index your code
hub / github.com/microsoft/SandDance / polygonInside

Function polygonInside

docs/app/js/sanddance-app.js:133101–133110  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

133099 if (visible1(x, y)) activeStream.point(x, y);
133100 }
133101 function polygonInside() {
133102 var winding = 0;
133103 for(var i = 0, n = polygon.length; i < n; ++i)for(var ring = polygon[i], j = 1, m = ring.length, point = ring[0], a0, a1, b0 = point[0], b1 = point[1]; j < m; ++j){
133104 a0 = b0, a1 = b1, point = ring[j], b0 = point[0], b1 = point[1];
133105 if (a1 <= y1) {
133106 if (b1 > y1 && (b0 - a0) * (y1 - a1) > (b1 - a1) * (x0 - a0)) ++winding;
133107 } else if (b1 <= y1 && (b0 - a0) * (y1 - a1) < (b1 - a1) * (x0 - a0)) --winding;
133108 }
133109 return winding;
133110 }
133111 // Buffer geometry within a polygon and then clip it en masse.
133112 function polygonStart() {
133113 activeStream = bufferStream, segments = [], polygon = [], clean = true;

Callers 1

polygonEndFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected