Generalized Cantor's Staircase

The Cantor's Staircase is a famous fractal function which, while flat almost everywhere and continuous, is still growing.

We model a fractal function on [0,1] as a sequence of boxes, each containing a scaled smaller copy of the whole function.

Here are some examples:

Normal Cantor's staircase

1,0,1.png

Try 1,0,1

Vertical Cantor's staircase

1,0:1,1.png

Try 1,0:1,1

Negative segment in the middle

1,1,-1,1,1.png

Try 1,1,-1,1,1

More variants

2,0:-1,2.png

Try 2,0:-1,2

2:1,1:2,2:1.png

Try 2:1,1:2,2:1

2:2,1,2:-2,1,2:2.png

Try 2:2,1,2:-2,1,2:2

Copyright (c) 2022 Konstantin Uvarin