回答編集履歴

1

書き足し

2022/01/17 13:59

投稿

thkana
thkana

スコア7652

test CHANGED
@@ -3,4 +3,23 @@
3
3
 
4
4
  sinθおよびcosθは、半径1の円上の点です。ということは、原点から(cosθ,sinθ)へのベクトルは長さ1であり、単位ベクトルです。x軸とベクトルのなす角はθです。
5
5
 
6
+ Processing的には、三角関数なんか知らなくてもtranslate()で原点移動してrotate()でぶん回して、あとは距離1ずつ進める、なんていう手段もありかも知れませんけれど。
7
+ ```Processing
8
+ int d=0;
9
+ void setup(){
10
+ size(300,300);
11
+ stroke(255);
12
+ fill(255);
13
+ frameRate(10);
14
+ }
15
+ void draw(){
16
+ background(0);
17
+ translate(width/2,height/2);
18
+ for(int i=0;i<8;i++){
19
+ rotate(TWO_PI/8);
20
+ line(-width*1.5,0,width*1.5,0);
21
+ circle(d,0,10);
22
+ d++;
23
+ }
24
+ }
6
- 以上。
25
+ ```