Handle case where line has identical start and end points

If line has same p1 and p2 returns NaN in current code. I believe the correct response is just the distance to one of the points. 

Did not confirm if line code has same issue since the formula is different. 

Prob need a test case, sorry, didn't make one. 

Thanks