0
次のコードで円を描こうとしています。私はそれを作成するために変更する必要がある値を把握できません。助けをお待ちしています。処理中に円を作成する方法がわからない
void setup() {
size(400, 400);
background(255,255,255);
}
void draw() {
float step=(2*PI)/120;
float theta_start=0;
float old_sx=map(theta_start,0,2*PI,4,width-4);
float old_sy1=map(sin(theta_start),-1,1,height-4,4);
float old_sy2=map(cos(theta_start),0,1*PI,1,width-2);
for(float theta=step;theta<=(2*PI)+step;theta+=step)
{
float screen_x=map(theta,0,2*PI,4,width-4);
float screen_y1=map(sin(theta),-1,1,height-4,4);
float screen_y2=map(cos(theta),0,1*PI,1,width-2);
//stroke(255,0,0);
//line(old_sx,old_sy1,screen_x,screen_y1);
//stroke(0,255,0);
// line(old_sx,old_sy2,screen_x,screen_y2);
stroke(0,0,255);
line(old_sy1,old_sy2,screen_y1,screen_y2);
old_sx=screen_x;
old_sy1=screen_y1;
old_sy2=screen_y2;
}
}
'ellipse()'関数を呼び出してみませんか? –