平衡点


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);

結果はこんな感じ.


連絡先など
最近の日記
  • 2024/06/19
    • 1. WSL2 での gpg-agent, ssh-agent
  • 2024/06/18
    • 1. WSL で Windows 側のフォントを利用する
  • 2024/06/17
    • 1. WSLとWindowsの時刻同期
  • 2024/06/12
    • 1. wsl2 で systemd
    • 2. wslg の設定
  • 2024/05/21
    • 1. GnuPG が 2.2.43 に更新されて, Emacs の EasyPG でファイルが保存できなくなりました
    • 2. 久々に esup を走らせたら
一覧
2006|03|04|05|06|07|08|09|10|11|12|
2007|01|02|03|04|05|06|07|08|09|10|11|12|
2008|01|02|03|04|05|06|07|08|09|10|11|12|
2009|01|02|03|04|05|06|07|08|09|10|11|12|
2010|01|02|03|04|05|06|07|08|09|10|11|12|
2011|01|02|03|04|05|06|07|08|09|10|11|12|
2012|02|03|04|08|09|10|11|12|
2013|01|02|03|04|05|06|08|09|10|11|12|
2014|01|02|04|05|06|07|08|09|10|11|12|
2015|01|02|03|04|05|06|07|09|10|
2016|02|03|
2017|01|02|03|05|06|07|09|11|12|
2018|03|06|07|10|11|12|
2019|01|02|03|04|05|07|10|12|
2020|01|02|03|04|05|08|09|10|11|12|
2021|01|02|03|05|06|07|08|09|11|12|
2022|01|02|03|04|05|06|08|10|11|12|
2023|02|03|04|06|08|09|11|12|
2024|01|02|03|04|05|06|
Back to Top ▲