Javascript Math getQuarant(deg)
// Get quarant from degree function getQuarant (deg) { if (deg < 0)/*ww w.ja v a2 s . c o m*/ deg+=360; if (deg >= 360) deg-=360; return Math.floor(deg/90); }