Loading...
Logo
Processing Forum
martymcwalk's Profile
1 Posts
2 Responses
0 Followers

Activity Trend

Last 30 days
Show:
Private Message
    Hi.
    I´d like to draw a smooth spiral.
    It looks a bit uneven, if I draw it with lines or ellipses, like here for example http://www.learningprocessing.com/exercises/chapter-13/exercise-13-5/ . I need thin lines.

    So in my code I did sth. like this: (not perfectly done, only for testing)

     float numofCircles = 1;
    PVector middleVec = new PVector(30,0);
    float radius = 50
     
     
      float totalRadian = numofCircles * PI * 2;
      float startRadian = -PI;
      float currentRadian = startRadian;
     
      float targetX;
      float targetY;

    //spiral starts from outside
     while (currentRadian < totalRadian)
      {
       
        currentRadian += PI/200;
        radius -=.05;
       
        targetX = cos(currentRadian) * radius + middleVec.x;
        targetY = sin(currentRadian) * radius + middleVec.y;
        treeGraphic.ellipse(targetX, targetY, 3, 3);
    }


    I think with bezier, you would get smoother curves, but not that easy.
    Any idea?

    Thanks, Martin