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

Function reversePolygon

docs/app/js/sanddance-app.js:101655–101668  ·  view source on GitHub ↗
(points, options)

Source from the content-addressed store, hash-verified

101653 if (!isClosedEx) visitor(points[endPointIndex], points[endPointIndex + 1], points[start], points[start + 1], numPoints - 1, 0);
101654}
101655function reversePolygon(points, options) {
101656 const { start =0 , end =points.length , size =2 } = options;
101657 const numPoints = (end - start) / size;
101658 const numSwaps = Math.floor(numPoints / 2);
101659 for(let i = 0; i < numSwaps; ++i){
101660 const b1 = start + i * size;
101661 const b2 = start + (numPoints - 1 - i) * size;
101662 for(let j = 0; j < size; ++j){
101663 const tmp = points[b1 + j];
101664 points[b1 + j] = points[b2 + j];
101665 points[b2 + j] = tmp;
101666 }
101667 }
101668}
101669function modifyPolygonWindingDirectionPoints(points, direction, options = {}) {
101670 const currentDirection = getPolygonWindingDirectionPoints(points, options);
101671 if (currentDirection !== direction) {

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected