1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

チェビシェフ螺旋(Chebyshev Spiral)

Posted at

はじめに

チェビシェフ螺旋(Chebyshev Spiral)を使うと、丸い多角形が描けます。
イラレで多角形を描いて、角を丸くしても、十分かもしれませんが、単一式でエレガントに描きたいという場合、使えるかもしれません。

例えば、丸い5角形が欲しかったら、
k=5
n=5
にすれば、描けます。
image.png

なお、super ellipseだと四角形のみですが、super fomulaなら丸い多角形を描けます。

極座標表記で

r=n+\frac{1}{k}\cos{n\theta}

コード

processing
size(800, 800);
background(255);
translate(400,400);
noStroke();

float r,x,y;
float k = 2;
for(int n=12; n>=1; n--){
  beginShape();
    for(float th=0; th<=2*PI; th+=0.002){
      r = n+1/k*cos(n*th);
      x = r*cos(th);
      y = r*sin(th);
      fill(n%2*255);
      curveVertex(x*30, y*30);
    }
  endShape();
}

結果画像

↓ k=2
image.png
↓ k=3
image.png
↓ k=4
image.png
↓ k=5
image.png
↓ k=6
image.png
↓ k=7
image.png
↓ k=8
image.png
↓ k=9
image.png
↓ k=10
image.png
↓ k=11
image.png
↓ k=12
image.png

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?