(vertex1, vertex2)
| 1 | // src/offset-polygon.ts |
| 2 | var TWO_PI = Math.PI * 2; |
| 3 | function 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 | } |
| 12 | function outwardEdgeNormal(vertex1, vertex2) { |
| 13 | var n = inwardEdgeNormal(vertex1, vertex2); |
| 14 | return { |
no outgoing calls
no test coverage detected