public double segment_distance(PlaPointFloat p_point){
  PlaPointFloat projection=perpendicular_projection(p_point);
  if (projection.is_contained_in_box(point_a,point_b,0.01))   return p_point.distance(projection);
  return Math.min(p_point.distance(point_a),p_point.distance(point_b));
}

public double segment_distance ( PlaPointFloat p_point ) { PlaPointFloat projection = perpendicular_projection ( p_point ) ; if ( projection . is_contained_in_box ( point_a , point_b , 0.01 ) ) return p_point . distance ( projection ) ; return Math . min ( p_point . distance ( point_a ) , p_point . distance ( point_b ) ) ; }
todo need to consider that the distance may not exist
