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

Function pseudoAngle

docs/app/js/sanddance-app.js:140146–140149  ·  view source on GitHub ↗
(dx, dy)

Source from the content-addressed store, hash-verified

140144exports.default = Delaunator;
140145// monotonically increases with real angle, but doesn't need expensive trigonometry
140146function pseudoAngle(dx, dy) {
140147 const p = dx / (Math.abs(dx) + Math.abs(dy));
140148 return (dy > 0 ? 3 - p : 1 + p) / 4; // [0..1]
140149}
140150function dist(ax, ay, bx, by) {
140151 const dx = ax - bx;
140152 const dy = ay - by;

Callers 1

_hashKeyMethod · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected