closest


      this.findClosest = function(exclude)
      {
        var minDist = 1000.0, foundIndex, dist, aXbX, aYbY;
        var i;
        var myPointMass, otherPointMass;    
  
        myPointMass = this.blobs[exclude].getMiddlePointMass(); 
        for(i = 0; i < this.blobs.length; i++)
        {
          if(i == exclude || this.blobs[i] == null)
          {
            continue; 
          }
          
          otherPointMass = this.blobs[i].getMiddlePointMass(); 
          aXbX = myPointMass.getXPos() - otherPointMass.getXPos(); 
          aYbY = myPointMass.getYPos() - otherPointMass.getYPos(); 
          dist = aXbX * aXbX + aYbY * aYbY; 
          if(dist < minDist)
          {
            minDist = dist; 
            foundIndex = i; 
          }
        }
        return foundIndex; 
      }