(x0, y0, x1, y1)
| 90 | } |
| 91 | |
| 92 | function getNormal(x0, y0, x1, y1) { |
| 93 | let direction = getDirection(x0, y0, x1, y1); |
| 94 | let normalizedVector = vec2.normalize(vec2.create(), direction); |
| 95 | let perpVector = vec2.rotate(vec2.create(), normalizedVector, vec2.create(), Math.PI/2); |
| 96 | let offsetVector = perpVector; // vec2.scale(vec2.create(), perpVector, normalDistance); |
| 97 | let normalX = -1 * offsetVector[0]; |
| 98 | let normalY = offsetVector[1]; |
| 99 | |
| 100 | return { |
| 101 | x: normalX, |
| 102 | y: normalY |
| 103 | }; |
| 104 | } |
| 105 | |
| 106 | for (let n=0; n<numEdges; n++) { |
| 107 | let pointIndex0 = edges[n].from; |
no test coverage detected