# Trávník's smooth self-referential formula - The limit and a role of epsilon

Go back to main page on Trávník's smooth self-referential formula.

## Limit

The formula includes following function with a limit:

The limit represents ideal of Bézier curves. But practically
just using sufficiently small number ε is enough. There is no
need to try compute the limit for displaying the formula. Let
me explain this in pictures on area of the formula for:

2.05 <= x < 3.75

35.45 <= y < 36.15

Rendering with ε=0.5:

Rendering with ε=0.1:

Rendering with ε=0.01:

Rendering with ε=0.00001:

Rendering with ε=0.00000001:

The ε just needs to be significantly smaller than pixel width. In above image pixel width is 0.00188. It is also useful to have it smaller than resolution of smallest detail which could have impact on aliasing.

I am aware that limit is not defined on the edges of shapes because of their expected discontinuity. But I'm happy that is it defined everywhere else.

In some sense the limit achieves nothing. What would happen if the limit would be removed along with ε and corresponding branching in Wc function that terminates recursion with π value when bounding box diagonal is smaller than ε? The function would be well defined everywhere except on the edges of shapes. On edges the recursive definition would not terminate making it not well defined there. That is pretty similar to what happens when this limit is present. But I still like the limit to express intent that you can get close with small enough ε and that you have a prescribed way how to terminate this unlimited recursion. There are different ways to terminate the recursion. Here is another different way:

There is one modification of Wc function in d < ε branch:

Wc(d, x, y, x_{1}, y_{1}, x_{2}, y_{2}, x_{3}, y_{3}, x_{4}, y_{4}, ε) = π if d < ε ∧ ((x_{4}−x_{1})⋅(y−y_{1})−(y_{4}−y_{1})⋅(x−x_{1})) > 0 = −π if d < ε ∧ ((x_{4}−x_{1})⋅(y−y_{1})−(y_{4}−y_{1})⋅(x−x_{1})) ≤ 0 = Wa(x, y, x_{1}, y_{1}, (x_{1}+x_{2})/2, (y_{1}+y_{2})/2, (x_{2}+x_{3}+x_{1}+x_{2})/4, (y_{2}+y_{3}+y_{1}+y_{2})/4, (x_{1}+3⋅x_{2}+3⋅x_{3}+x_{4})/8, (y_{4}+3⋅y_{3}+3⋅y_{2}+y_{1})/8, ε) +Wa(x, y, (x_{4}+3⋅x_{3}+3⋅x_{2}+x_{1})/8, (y_{4}+3⋅y_{3}+3⋅y_{2}+y_{1})/8, (x_{4}+2⋅x_{3}+x_{2})/4, (y_{4}+2⋅y_{3}+y_{2})/4, (x_{3}+x_{4})/2, (y_{3}+y_{4})/2, x_{4}, y_{4}, ε), else

This results in line x_{1},y_{1} to x_{4},y_{4} approximation where rendered pixel coordinates are closer to curve than ε.

Class SelfFormulaFastEpsSmoother in sources which implements this modified variant. See how it converges with various ε values. It looks nicer:

Rendering with ε=0.5:

Rendering with ε=0.1:

Rendering with ε=0.01:

Rendering with ε=0.00001:

Rendering with ε=0.00000001:

So it is much smoother, but I did not want to complicate the formula so it contains the concise variant of Wc function.

Go back to main page on Trávník's smooth self-referential formula.

Back to index - Jakub Trávník's resources.