   perpendicularAxes: ->
     for pair in Utils.pairs @points()
       Vec.perpendicular Vec.sub pair[1], pair[0]
+
+  perpendicularAxesFacing: (other) ->
+    dir = Vec.sub other.position, @position
+    (axis for axis in @perpendicularAxes() when Vec.dotProduct(axis, dir) > 0)
 
 class Rectangle extends Polygon
   constructor: (sizeX, sizeY, position, angle, @color) ->

  debug: {}
  resetDebug: -> @debug = {}
  drawDebug: (ctx) ->
    if ref = @debug.reference
      Utils.debugLine ctx, ref.from, ref.to, "#0F0"
    if inc = @debug.incident
      Utils.debugLine ctx, inc.from, inc.to, "#FF0"
    if clipped = @debug.clipped
      Utils.debugLine ctx, clipped[0], clipped[1], "#0FF"
    if trimmed = @debug.trimmed
      Utils.debugPoints ctx, "#000", trimmed...


        minOverlap = overlap
        minAxis = axis

    for axis in other.perpendicularAxesFacing(this)
      us = @projectionInterval axis
      them = other.projectionInterval axis
      overlap = Utils.intervalOverlap us, them
