nonlinear iteration

edited November 2013 in Questions about Code

hi, I try to make an iteration with a step that is getting smaller and smaller

I've made this :

    for (float i= 0 ; i < 100 ; i= ceil(i + (100-i)/5) ) {
      line(0, i, width, i);
     }

is there a more conventional way ?

Answers

  • Answer ✓

    For example:

      for (int i = 0, s = 20; i < height ; i += s, s--) {
        line(0, i, width, i);
      }
    
Sign In or Register to comment.