Skip to content

Instantly share code, notes, and snippets.

@calvinmetcalf
Created August 29, 2013 01:30
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 calvinmetcalf/6373341 to your computer and use it in GitHub Desktop.
Save calvinmetcalf/6373341 to your computer and use it in GitHub Desktop.
kx = x1 - x0 ? (Q - 1) / (x1 - x0) : 1;
ky = y1 - y0 ? (Q - 1) / (y1 - y0) : 1;
//unpacked
if(xMax !== xMin){
scaleX=(quantizationFactor - 1) / (xMax - xMin);
}else{
scaleX=1;
}
if(yMax !== yMin){
scaleY=(quantizationFactor - 1) / (yMax - yMin);
}else{
scaleY=1;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment