Limit distance table to 10000 points.

The 10*N+1 approach for sizing the distance table worked well for
boundary curves -- they typically have a small N at particular key points.
This approach ensures those key points are hit and there are 10
intermediate points.

However, intersection curves usually have many more points which are more
uniformly distributed.  Consequently, 10*N+1 can lead to a very large
number of points with very little gain.

So, when that results in greater than 10000 points, nref is calculated to
target about 10000 points, but still hit key points.
Make sure distance table has points for very fine curves

For cases where the number of sections was more than twice nseglim,
integer division would cause nref=0.  This makes sure that nref is
always >= 1.