[Tex/LaTex] How to draw spherical triangles

asymptotediagramsmetapostpstrickstikz-pgf

Does anyone know how to draw spherical arcs and spherical triangles using LaTeX?

Best Answer

enter image description here

Here is MWE using Asymptote 3D drawing:

% sphtri.tex:
\documentclass{article}
\usepackage[inline]{asymptote}
\usepackage{lmodern}

\begin{document}
\begin{figure}
\centering
\begin{asy}
settings.prc=false;
settings.tex="pdflatex";
settings.render=0;

import three;
size(100); size3(100);

currentprojection=orthographic(
camera=(5.4290316601351,2.94352790610013,1.1108527434919),up=Z,target=O,zoom=0.7);
real r=1;

triple A,B,C;
A=dir(60.0,20.0);
B=dir(40.0,40.0);
C=dir(80.0,80.0);

guide3 AB=arc(O,A,B,CCW);
guide3 BC=arc(O,B,C,CCW);
guide3 CA=arc(O,C,A,CCW);

radialshade(project(circle((0,0,0),1
,currentprojection.camera-currentprojection.target))
,rgb(0.79,0.79,0.85), project(O), 1.0
,rgb(0.99,0.99,0.85), project(O), 0.2
);

guide3 g=AB--BC--CA--cycle;
fill(project(g),rgb(1,1,0.8));

draw(arc(O,A,B,CCW),red+1bp);
draw(arc(O,B,C,CCW),olive+1bp);
draw(arc(O,C,A,CCW),blue+1bp);

pen alphaPen=red;
pen betaPen=darkgreen;
pen gammaPen=blue;

void markAngle(string lab,triple v, guide3 gright, guide3 gleft, real arcdist, pen arcpen=currentpen){
  triple t,s;
  t=arcpoint(gright,arcdist); 
  s=arcpoint(gleft,arcdist);
  draw(arc(v,t,s,cross(t-v,s-v),CCW),arcpen);
  label("$"+lab+"$",(v+t+s)/3,arcpen);
}

real ra,rb,rg; 
ra=0.17; rb=0.21; rg=0.4;
markAngle("\alpha",A,reverse(CA),AB,ra,alphaPen);
markAngle("\beta",B,reverse(AB),BC,rb,betaPen);
markAngle("\gamma",C,reverse(BC),CA,rg,gammaPen);

dot(A,red); dot(B,olive); dot(C,blue);

label("$A$",project(A),SW);
label("$B$",project(B),N);
label("$C$",project(C),SE);    
\end{asy}
\caption{Spherical arcs and spherical triangles}
\end{figure}
\end{document}
% 
% To process it with `latexmk`, create file `latexmkrc`:
% 
%     sub asy {return system("asy '$_[0]'");}
%     add_cus_dep("asy","eps",0,"asy");
%     add_cus_dep("asy","pdf",0,"asy");
%     add_cus_dep("asy","tex",0,"asy");
% 
% and run `latexmk -pdf sphtri.tex`.
Related Question