5
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Gadflyでジバニャンの方程式をプロットする、あるいはz=0を満たす等高線をプロットするには

Last updated at Posted at 2016-02-28
function jibanyan_equation(x, y)
    min(max(min(1-(x/108)^2-(y/94)^2,y),
    min(1-((abs(x)-119)/103)^2-((y-56)/86)^2,
    1-((abs(x)-15)/77)^2-((y-119)/100)^2),
    1-((abs(x)-42)/66)^2-(y/55)^2,
    min(55+y,51-abs(x),-y)),
    3*abs(y-100)-2*(x-75)) * min(min(max(min(1-(x/106)^2-(y/92)^2,y),
    min(1-((abs(x)-119)/101)^2-((y-56)/84)^2,
    ((abs(x)-99)/40)^2+((y-54)/86)^2-1,92-abs(x)),
    1-((abs(x)-42)/64)^2-(y/53)^2),
    min(((abs(x)-52)/26)^2+((y+28)/26)^2-1,
    ((abs(x)-51)/13)^2+(y/13)^2-1,
    max(abs(x)-51,y))),abs(x/51+10/51*sin(abs(y/61.2)^(1.2)*pi*(7/2)))^(2/3)+abs(y/61.2)^(2/3)-1) * min(1-(x/32)^2-((y+30)/32)^2,
    1-((abs(x)+5)/22)^2-((y-18)/22)^2) * min(1-((abs(x)-18)/20)^2-((y+10)/20)^2,
    ((abs(x)-20)/22)^2+((y+7)/20)^2-1) * (1-((abs(x)-51)/11)^2-(y/11)^2)
end

using Gadfly
plot(z=(x,y) -> jibanyan_equation(x, y),
     x=linspace(-150,150,1000), y=linspace(-150,150,1000), Geom.contour(levels=[0]))

Gadfly_Jiba.jpg

Geom.contourのオプションにlevels=[0]を指定しないと残念な結果になる。

bad_jibanyan.jpg

参考資料

関連記事

5
4
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
5
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?