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

Function normalize

docs/app/js/sanddance-app.js:69969–69977  ·  view source on GitHub ↗
(out, a)

Source from the content-addressed store, hash-verified

69967 return out;
69968}
69969function normalize(out, a) {
69970 var x = a[0], y = a[1];
69971 var len1 = x * x + y * y;
69972 if (len1 > 0) //TODO: evaluate use of glm_invsqrt here?
69973 len1 = 1 / Math.sqrt(len1);
69974 out[0] = a[0] * len1;
69975 out[1] = a[1] * len1;
69976 return out;
69977}
69978function dot(a, b) {
69979 return a[0] * b[0] + a[1] * b[1];
69980}

Callers 5

sanddance-app.jsFile · 0.70
weightsFunction · 0.70
bimapFunction · 0.70
polymapFunction · 0.70
SyntheticEventFunction · 0.50

Calls 5

validateFunction · 0.70
copyFlatRingFunction · 0.70
isSimpleFunction · 0.70
copyNestedRingFunction · 0.70

Tested by

no test coverage detected