public static double nonRobustComputeEdgeDistance(Coordinate p,Coordinate p1,Coordinate p2){
  double dx=p.x - p1.x;
  double dy=p.y - p1.y;
  double dist=Math.sqrt(dx * dx + dy * dy);
  Assert.isTrue(!(dist == 0.0 && !p.equals(p1)),"Invalid distance calculation");
  return dist;
}

public static double nonRobustComputeEdgeDistance ( Coordinate p , Coordinate p1 , Coordinate p2 ) { double dx = p . x - p1 . x ; double dy = p . y - p1 . y ; double dist = Math . sqrt ( dx * dx + dy * dy ) ; Assert . isTrue ( ! ( dist == 0.0 && ! p . equals ( p1 ) ) , "Invalid distance calculation" ) ; return dist ; }
this function is non - robust , since it may compute the square of large numbers . currently not sure how to improve this .
