平衡点
2009/11/12
_ asymptote で緯度経度動径座標系
D 論用に座標系を書くためにasymptote で座標系の絵を描こうとしてジタバタしていた.
コードは汚いけれどとりあえずできたのではっつける.
- Arrow3 で矢印のサイズを変更するにはどうするんだろう...
- (2009/11/13 追記) Arrow3(size=10) とかでイイみたい. 初歩だ.
// // longitude-latitude-radial(spherical) coordinate. // usepackage("txfonts"); import solids; //settings.render=0; settings.prc=false; // screen settings size(400,0); currentprojection=orthographic(0,4,2,center=true); //pen settings pen dark=darkcyan; pen sp=cyan; defaultpen(linewidth(2)); defaultpen(fontsize(16)); //parameter settings real xi=0.35; triple origin=(0,0,0); // definition x, y, z real x(real rad, real lambda, real vphi) { return rad*cos(lambda)*cos(vphi);} real y(real rad, real lambda, real vphi) { return rad*sin(lambda)*cos(vphi);} real z(real rad, real vphi) { return rad*sin(vphi);} // inner core real r_in_radius=xi/(1-xi); revolution r_in_sphere=sphere(r_in_radius); draw(r_in_sphere,sp+linewidth(1),m=1,longitudinalpen=nullpen); draw(r_in_sphere.silhouette(),sp+linewidth(2)); triple vect_r_in=(x(rad=r_in_radius, lambda=0, vphi=45*pi/180), y(rad=r_in_radius, lambda=0, vphi=45*pi/180), z(rad=r_in_radius, vphi=45*pi/180)); path3 r_in=origin..vect_r_in; draw(r_in,dark,Arrow3(size=10)); label("$r_{i}$",r_in,NE); // outer core real r_out_radius=1/(1-xi); revolution r_out_sphere=sphere(r_out_radius); draw(r_out_sphere,sp+linewidth(1),m=1,longitudinalpen=nullpen); draw(r_out_sphere.silhouette(),sp+linewidth(2)); triple vect_r_out=(x(rad=r_out_radius, lambda=30*pi/180, 0), y(rad=r_out_radius, lambda=30*pi/180, 0), z(rad=r_out_radius, 0)); path3 r_out=origin..vect_r_out; draw(r_out,dark,Arrow3(size=10)); label("$r_{o}$",r_out,SE); // radis d path3 length_scale=(r_in_radius,0,0)..(r_out_radius,0,0); draw(length_scale,black,Arrows3(size=10)); label("$D=r_{o}-r_{i}$",(1,0,0),N); // gravity g triple vect_g_in=(x(rad=1.4,lambda=0,vphi=60*pi/180), y(rad=1.4,lambda=0,vphi=60*pi/180), z(rad=1.4,vphi=60*pi/180)); triple vect_g_out=(x(rad=0.8,lambda=0,vphi=60*pi/180), y(rad=0.8,lambda=0,vphi=60*pi/180), z(rad=0.8,vphi=60*pi/180)); path3 gravity=vect_g_in..vect_g_out; draw(gravity,black,Arrow3(size=10)); label("$\mathbf{g}$",gravity,N); // rotation axis triple vect_rad_axis=(x(rad=r_out_radius, lambda=0, vphi=90*pi/180), y(rad=r_out_radius, lambda=0, vphi=90*pi/180), z(rad=r_out_radius, vphi=90*pi/180)); draw(origin..vect_rad_axis,dark+dashed+linewidth(1)); draw((0,0,vect_rad_axis.z+0.05)..(0,0,r_out_radius+0.3), dark+solid,Arrow3(size=10)); draw(arc((r_out_radius+0.2)*Z,0.1,90,-20,90,160),dark,Arrow3(size=10)); label("$\mathbf{\Omega}=\Omega\mathbf{k}$",(0,0,r_out_radius+0.5),SE); // position vector real r_pos_radius=0.7*(1+xi)/(1-xi); triple vect_pos=(x(rad=r_pos_radius, lambda=140*pi/180, vphi=60*pi/180), y(rad=r_pos_radius, lambda=140*pi/180, vphi=60*pi/180), z(rad=r_pos_radius, vphi=60*pi/180)); draw(origin..vect_pos,dark,Arrow3(size=10)); label("$\mathbf{r}$", origin..(vect_pos.x*1.5,vect_pos.y*1.5,vect_pos.z*1.5),NW); // lambda draw(origin..(vect_pos.x,vect_pos.y,0),dark+dashed+linewidth(1)); draw(vect_pos..(vect_pos.x,vect_pos.y,0),dark+dashed+linewidth(1)); triple vect_lambda=(x(rad=r_out_radius, lambda=100*pi/180, vphi=0), y(rad=r_out_radius, lambda=100*pi/180, vphi=0), z(rad=r_out_radius, vphi=0)); draw(origin..vect_lambda,dark+dashed+linewidth(1)); path3 l_lambda=arc(origin, (vect_pos.x,vect_pos.y,0), (vect_lambda.x,vect_lambda.y,0),CCW); draw(reverse(l_lambda),dark,Arrow3(size=10)); label("$\lambda$",l_lambda,SW); // phi path3 l_phi=arc(origin, (0.5*vect_pos.x,0.5*vect_pos.y,0), (0.5*vect_pos.x,0.5*vect_pos.y,0.5*vect_pos.z),CCW); draw(l_phi,dark+linewidth(2),Arrow3(size=10)); label("$\varphi$",l_phi,E);
結果はこんな感じ.