public void fill ( Space target , float sx , float sy , float cost ) { if ( cost >= this . cost ) { return ; } this . cost = cost ; if ( target == this ) { return ; } for ( int i = 0 ; i < getLinkCount ( ) ; i ++ ) { Link link = getLink ( i ) ; float extraCost = link . distance2 ( sx , sy ) ; float nextCost = cost + extraCost ; link . getTarget ( ) . fill ( target , link . getX ( ) , link . getY ( ) , nextCost ) ; } }
Fill the spaces based on the cost from a given starting point