angles.js
function(x, y, k, shift) {

      var s = this['SCALE'];

      if (k === undefined)
        k = 4; // How many regions? 4 = quadrant, 8 = octant, ...

      if (shift === undefined)
        shift = 0; // Rotate the coordinate system by shift° (positiv = counter-clockwise)

      /* shift = PI / k, k = 4:
       *   I) 45-135
       *  II) 135-225
       * III) 225-315
       *  IV) 315-360
       */

      /* shift = 0, k = 4:
       *   I) 0-90
       *  II) 90-180
       * III) 180-270
       *  IV) 270-360
       */

      var phi = (Math.atan2(y, x) + TAU) / TAU;

      if (Math.abs(phi * s % (s / k)) < EPS) {
        return 0;
      }

      return 1 + mod(Math.floor(k * shift / s + k * phi), k);
    }
function(x, y, k, shift) {

      var s = this['SCALE'];

      if (k === undefined)
        k = 4; // How many regions? 4 = quadrant, 8 = octant, ...

      if (shift === undefined)
        shift = 0; // Rotate the coordinate system by shift° (positiv = counter-clockwise)

      /* shift = PI / k, k = 4:
       *   I) 45-135
       *  II) 135-225
       * III) 225-315
       *  IV) 315-360
       */

      /* shift = 0, k = 4:
       *   I) 0-90
       *  II) 90-180
       * III) 180-270
       *  IV) 270-360
       */

      var phi = (Math.atan2(y, x) + TAU) / TAU;

      if (Math.abs(phi * s % (s / k)) < EPS) {
        return 0;
      }

      return 1 + mod(Math.floor(k * shift / s + k * phi), k);
    }
function ( x , y , k , shift ) { var s = this [ 'SCALE' ] ; if ( k === undefined ) k = 4 ; // How many regions? 4 = quadrant, 8 = octant, ... if ( shift === undefined ) shift = 0 ; // Rotate the coordinate system by shift° (positiv = counter-clockwise) /* shift = PI / k, k = 4:
       *   I) 45-135
       *  II) 135-225
       * III) 225-315
       *  IV) 315-360
       */ /* shift = 0, k = 4:
       *   I) 0-90
       *  II) 90-180
       * III) 180-270
       *  IV) 270-360
       */ var phi = ( Math . atan2 ( y , x ) + TAU ) / TAU ; if ( Math . abs ( phi * s % ( s / k ) ) < EPS ) { return 0 ; } return 1 + mod ( Math . floor ( k * shift / s + k * phi ) , k ) ; }
Returns the quadrant

@param {number} x The point x-coordinate
@param {number} y The point y-coordinate
@param {number=} k The optional number of regions in the coordinate-system
@param {number=} shift An optional angle to rotate the coordinate system
@returns {number}
Returns the quadrant