Utilizamos seu perfil e dados de atividades no LinkedIn para personalizar e exibir anúncios mais relevantes. Altere suas preferências de anúncios quando desejar.
Próximos SlideShares
Carregando em…5
×

# ｒで踊るパスタ

• Full Name
Comment goes here.

Are you sure you want to Yes No
• Seja o primeiro a comentar

### ｒで踊るパスタ

1. 1. Ｒで踊るパスタTokyo.Lang.R 2012/4/1 @manozo 1
2. 2. 「Pasta by Design」という本 2
3. 3. Pasta Geometries 3
4. 4. 4
5. 5. 5
6. 6. 6
7. 7. Ｒで書いてみてたlibrary(rgl)i<‐1:60j<‐1:100x<‐function(i,j)(10*sin(i/120*pi)^0.5  +  i/400*sin(3*j/10*pi))*cos(19*j/2000*pi+0.03*pi)y<‐function(i,j)(10*sin(i/120*pi)     + i/400*cos(3*j/10*pi))*sin(19*j/2000*pi+0.03*pi)z<‐function(i,j)  5*cos(i/120*pi)^5*sin(j/100*pi) ‐ 5*sin(j/100*pi)*cos(i/120*pi)^200pasta<‐data.frame(x=as.vector(outer(i,j,x)),y=as.vector(outer(i,j,y)),z=as.vector(outer(i,j,z)))plot3d(pasta,aspect=c(1,0.5,0.25)) 7
8. 8. 結果rgl.snapshot("pasta.png") 8
9. 9. 踊らせるためにplot(function(x)sin(x),0,pi*4)curve(sin(x),0,pi*4) 9
10. 10. パスタを踊らせるplot3d(pasta)plot3d(pasta,xlab="",ylab="",zlab="",aspect=c(1,0. 5,0.25)) #ラベルがうまく消えないのでrgl.clear(type="bbox")#boxを消去th=90;fo=45;ph=45 #範囲内で適当な数字をi<‐0;while(1)rgl.viewpoint( theta=sin(i<‐i+0.02)*th+th,  #0:360 fov  =cos(i)*fo+fo, #0:179 phi  =cos(i)*ph, #‐90:90 zoom=.5)#sin(),cos()も適当に⼊れ替えて 10
11. 11. Ｄ Ｅ Ｍ Ｏ踊るパスタ 11
12. 12. パスタを踊らせてみてください 終わり 12