MCPcopy Create free account
hub / github.com/Stanko/offset-polygon / inwardEdgeNormal

Function inwardEdgeNormal

lib/offset-polygon.js:3–11  ·  view source on GitHub ↗
(vertex1, vertex2)

Source from the content-addressed store, hash-verified

1// src/offset-polygon.ts
2var TWO_PI = Math.PI * 2;
3function inwardEdgeNormal(vertex1, vertex2) {
4 const dx = vertex2.x - vertex1.x;
5 const dy = vertex2.y - vertex1.y;
6 const edgeLength = Math.sqrt(dx * dx + dy * dy);
7 return {
8 x: -dy / edgeLength,
9 y: dx / edgeLength
10 };
11}
12function outwardEdgeNormal(vertex1, vertex2) {
13 var n = inwardEdgeNormal(vertex1, vertex2);
14 return {

Callers 2

outwardEdgeNormalFunction · 0.70
createPolygonFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected