protected void calcAttraction(){
  for (int i=0; i < vertexArray.length; i++) {
    for (int k=0; k < neighbours[i].length; k++) {
      int j=neighbours[i][k];
      if (i != j) {
        double xDelta=cellLocation[i][0] - cellLocation[j][0];
        double yDelta=cellLocation[i][1] - cellLocation[j][1];
        double deltaLengthSquared=xDelta * xDelta + yDelta * yDelta - radiusSquared[i] - radiusSquared[j];
        if (deltaLengthSquared < minDistanceLimitSquared) {
          deltaLengthSquared=minDistanceLimitSquared;
        }
        double deltaLength=Math.sqrt(deltaLengthSquared);
        double force=(deltaLengthSquared) / forceConstant;
        double displacementX=(xDelta / deltaLength) * force;
        double displacementY=(yDelta / deltaLength) * force;
        if (isMoveable[i]) {
          this.dispX[i]-=displacementX;
          this.dispY[i]-=displacementY;
        }
        if (isMoveable[j]) {
          dispX[j]+=displacementX;
          dispY[j]+=displacementY;
        }
      }
    }
  }
}

protected void calcAttraction ( ) { for ( int i = 0 ; i < vertexArray . length ; i ++ ) { for ( int k = 0 ; k < neighbours [ i ] . length ; k ++ ) { int j = neighbours [ i ] [ k ] ; if ( i != j ) { double xDelta = cellLocation [ i ] [ 0 ] - cellLocation [ j ] [ 0 ] ; double yDelta = cellLocation [ i ] [ 1 ] - cellLocation [ j ] [ 1 ] ; double deltaLengthSquared = xDelta * xDelta + yDelta * yDelta - radiusSquared [ i ] - radiusSquared [ j ] ; if ( deltaLengthSquared < minDistanceLimitSquared ) { deltaLengthSquared = minDistanceLimitSquared ; } double deltaLength = Math . sqrt ( deltaLengthSquared ) ; double force = ( deltaLengthSquared ) / forceConstant ; double displacementX = ( xDelta / deltaLength ) * force ; double displacementY = ( yDelta / deltaLength ) * force ; if ( isMoveable [ i ] ) { this . dispX [ i ] -= displacementX ; this . dispY [ i ] -= displacementY ; } if ( isMoveable [ j ] ) { dispX [ j ] += displacementX ; dispY [ j ] += displacementY ; } } } } }
calculates the attractive forces between all laid out nodes linked by edges
