public double weighted_distance(ShapeTileBox p_other,double p_horizontal_weight,double p_vertical_weight){
  double result;
  double max_ll_x=Math.max(box_ll.v_x,p_other.box_ll.v_x);
  double max_ll_y=Math.max(box_ll.v_y,p_other.box_ll.v_y);
  double min_ur_x=Math.min(box_ur.v_x,p_other.box_ur.v_x);
  double min_ur_y=Math.min(box_ur.v_y,p_other.box_ur.v_y);
  if (min_ur_x >= max_ll_x) {
    result=Math.max(p_vertical_weight * (max_ll_y - min_ur_y),0);
  }
 else   if (min_ur_y >= max_ll_y) {
    result=Math.max(p_horizontal_weight * (max_ll_x - min_ur_x),0);
  }
 else {
    double delta_x=max_ll_x - min_ur_x;
    double delta_y=max_ll_y - min_ur_y;
    delta_x*=p_horizontal_weight;
    delta_y*=p_vertical_weight;
    result=Math.sqrt(delta_x * delta_x + delta_y * delta_y);
  }
  return result;
}

public double weighted_distance ( ShapeTileBox p_other , double p_horizontal_weight , double p_vertical_weight ) { double result ; double max_ll_x = Math . max ( box_ll . v_x , p_other . box_ll . v_x ) ; double max_ll_y = Math . max ( box_ll . v_y , p_other . box_ll . v_y ) ; double min_ur_x = Math . min ( box_ur . v_x , p_other . box_ur . v_x ) ; double min_ur_y = Math . min ( box_ur . v_y , p_other . box_ur . v_y ) ; if ( min_ur_x >= max_ll_x ) { result = Math . max ( p_vertical_weight * ( max_ll_y - min_ur_y ) , 0 ) ; } else if ( min_ur_y >= max_ll_y ) { result = Math . max ( p_horizontal_weight * ( max_ll_x - min_ur_x ) , 0 ) ; } else { double delta_x = max_ll_x - min_ur_x ; double delta_y = max_ll_y - min_ur_y ; delta_x *= p_horizontal_weight ; delta_y *= p_vertical_weight ; result = Math . sqrt ( delta_x * delta_x + delta_y * delta_y ) ; } return result ; }
computes the weighted distance to the box p_other .
