Processing で星を作る
上記のような星をProcessingで描画します。Processingは初心者です。
コード
size(60, 60); background(255); noStroke(); fill(152, 251, 152); int b; int a[] = {1,4,2,5,3}; beginShape(); for (int i = 0; i < 5; i++) { b = a[i] - 1; float x = 30 * cos(2 * PI * b / 5 + PI / 2) + 30; float y = 30 * sin(2 * PI * b / 5 - PI / 2) + 30; vertex(x, y); } endShape();
Y軸は、下に行くほど増加するので、正負を逆にして考える必要があります。