if people want to resample a spline to a single point, there is a divide by zero in the logic there :) what should it do? not resample the line at all? resample it to two points? i.e. 
if(count<2) count = 2; ?