Skip to content

Instantly share code, notes, and snippets.

@wprater
Last active January 3, 2016 07:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wprater/8430194 to your computer and use it in GitHub Desktop.
Save wprater/8430194 to your computer and use it in GitHub Desktop.
scaled agngle within min bounds
var radiusEarth = 6372.796924;
var dist = 2.0;
var maxAngle = dist / radiusEarth;
var minAngle = 0.25 / radiusEarth;
var cosdif = Math.cos(maxAngle) - 1;
var fuzzScale = Math.random() * (0.999999 - minAngle) + minAngle;
var scaledDist = Math.acos(fuzzScale * cosdif + 1);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment