MCPcopy Index your code
hub / github.com/ericdrowell/ElGrapho / getNormal

Function getNormal

engine/src/VertexBridge.js:92–104  ·  view source on GitHub ↗
(x0, y0, x1, y1)

Source from the content-addressed store, hash-verified

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;

Callers 2

addLineFunction · 0.85
VertexBridge.jsFile · 0.85

Calls 1

getDirectionFunction · 0.85

Tested by

no test coverage detected