Loading...
Processing Forum
Recent Topics
All Forums
Screen name:
martymcwalk
martymcwalk's Profile
1
Posts
2
Responses
0
Followers
Activity Trend
Last 30 days
Last 30 days
Date Interval
From Date :
To Date :
Go
Loading Chart...
Posts
Responses
PM
Show:
All
Discussions
Questions
Expanded view
List view
Private Message
drawing smooth spiral
[6 Replies]
08-Feb-2012 11:07 AM
Forum:
Programming Questions
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
«Prev
Next »
Moderate user : martymcwalk
Forum