Before I make a bug report on this I thought i'd get the opinions of you ppl. (cos I don't wanna get laughed at for my appauling knowledge of Maths
The class java.awt.geom.Line2D has a method :-
public static double ptLineDistSq(double X1, double Y1, double X2, double Y2, double PX, double PY)
It calculates the distance (squared) between a given point and the nearest part of a line segment.
If however you pass in a line segment of zero length (X1=X2, Y1=Y2), the method performs a div by zero, which causes NaN to be returned.
I believe this is a bug, as the method documentation makes no exceptions to valid input.
Also IMO the distance from a point to a line segment still has a value even if the line segment has a zero length.
A simple sanity check at the start of the method would fix it,
if(X1==X2 && Y1==Y2) return (X1-PX)*(X1-PX)+(Y1-PY)*(Y1-PY);
So, whadda you reckon, is it a bug?