 # Numerical issue while evaluating nurbs around last knot vector value

This post is related to another one.

I am comparing results obtained for a theoretical circle and for a circular nurbs.
To do so, I compute the distance in a direction from a random inner point to the shape. The goal is to find the intersection point of the circle with the half-line determined by the point and the direction.

Almost every time, the results agree within 1.0E-13.
But when the intersection point comes next to the loop point of the nurbs, being on the side of the lasts knot vector values, I observe an increase of the error. It seams that it is not observed if being on the side of the starting values of the knot vector.

To be more precise :
For the circular nurbs, the 8 knot vector values are 0, 0, 1/3, 1/3, 2/3, 2/3, 1, 1
When my algorithm works with parametric coordinate values next to 1, I observe an error which seams too high.

Maybe the first question to ask is : Is it possible to evaluate the nurbs curve on parametric coordinate = 1.0 ?

Yes, you should be able to evaluate the curve at t=1. I think that maybe you are suffering from floating point representation error. Can you try with integer knot values (0,0,1,1,2,2,3,3) to see if this makes any difference? Values like 0.333333333 and 0.66666667 cannot be represented exactly and you may run into problems there. Then again, the evaluation is by definition a floating point problem and suffers generally from floating point rounding errors. Maybe you expect too much?
Are all the result within ON_ZERO_TOLERANCE (1E-12) ?

Also, even if you can represent a circle in NURBS exactly, the t-value on the NURBS curve does not represent `(x,y) = sin(t), cos(t)` - otherwise you would have found a rational expression for the irrational functions `sin` and `cos`.

Ok it is a good thing to know that it is possible to evaluate the nurbs on 1.0.
And thanks also for the knot vector trick.
What you say about the tolerance gave me an idea : there seams to be a problem in the algorithm I wrote with some kind of tolerance. I have to check it.
Thanks.

I’ve found it, the error was in the algorithm I wrote.
Mathematically the problem is periodic when doing a loop around the circle, but what I’ve wrote wasn’t taking the periodicity fully into account…
So the nurbs was evaluated out of the knot vector span, which leads to the error I was observing.