lib/pie.js
function(referencePoint, otherPoint) {
    if (this.yDown) {
      if (otherPoint.y > referencePoint.y) {
        otherPoint = {
          x: otherPoint.x,
          y: referencePoint.y - (otherPoint.y - referencePoint.y)
        }
      } else if (otherPoint.y < referencePoint.y) {
        otherPoint = {
          x: otherPoint.x,
          y: referencePoint.y + (referencePoint.y - otherPoint.y)
        }
      }
    }

    var delta = vec2d(otherPoint).minus(vec2d(referencePoint))
    var weird = radiansToWeird(delta.angle())
    var compass = weirdToCompass(weird)

    for (var i = 0; i < this.slices.length; i++) {
      if (this.slices[i].contains(compass)) {
        return this.slices[i].number
      }
    }
  }
function(referencePoint, otherPoint) {
    if (this.yDown) {
      if (otherPoint.y > referencePoint.y) {
        otherPoint = {
          x: otherPoint.x,
          y: referencePoint.y - (otherPoint.y - referencePoint.y)
        }
      } else if (otherPoint.y < referencePoint.y) {
        otherPoint = {
          x: otherPoint.x,
          y: referencePoint.y + (referencePoint.y - otherPoint.y)
        }
      }
    }

    var delta = vec2d(otherPoint).minus(vec2d(referencePoint))
    var weird = radiansToWeird(delta.angle())
    var compass = weirdToCompass(weird)

    for (var i = 0; i < this.slices.length; i++) {
      if (this.slices[i].contains(compass)) {
        return this.slices[i].number
      }
    }
  }
function ( referencePoint , otherPoint ) { if ( this . yDown ) { if ( otherPoint . y > referencePoint . y ) { otherPoint = { x : otherPoint . x , y : referencePoint . y - ( otherPoint . y - referencePoint . y ) } } else if ( otherPoint . y < referencePoint . y ) { otherPoint = { x : otherPoint . x , y : referencePoint . y + ( referencePoint . y - otherPoint . y ) } } } var delta = vec2d ( otherPoint ) . minus ( vec2d ( referencePoint ) ) var weird = radiansToWeird ( delta . angle ( ) ) var compass = weirdToCompass ( weird ) for ( var i = 0 ; i < this . slices . length ; i ++ ) { if ( this . slices [ i ] . contains ( compass ) ) { return this . slices [ i ] . number } } }
Tells what slice some point is in relative to a reference point.

@param referencePoint Object with x and y properties
@param otherPoint Object with x and y properties
@return zero based slice number
Tells what slice some point is in relative to a reference point .