# How to draw spherical triangles?

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

• A package like »pst-3dplot« or »tikz-3dplot« could help here. Aug 25 '13 at 8:49
• ePiX has built-ins for this, if you don't mind using external software. Aug 25 '13 at 11:46
• You can fake it in picture mode by drawing all the "straight lines" using arcs. Getting to look right won't be easy. Aug 25 '13 at 14:33
• parametrize them and use pgfplots or PSTricks? Aug 25 '13 at 16:05
• I think this example gives a good overview of all cases of spherical coordinates with tikz-3dplot: texample.net/tikz/examples/the-3dplot-package Aug 25 '13 at 20:33

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

,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]'");}
%
% and run latexmk -pdf sphtri.tex.

\documentclass{article}
\usepackage{pst-3dplot}
\begin{document}

\begin{pspicture}(-4,-4)(4,5)
\psset{Alpha=45,Beta=30,linestyle=dashed}
\pstThreeDSphere[linecolor=black!15](0,0,0){4}
\pstThreeDCoor[linestyle=solid,xMin=-5,xMax=5,yMax=5,zMax=5,IIIDticks]
%
\psset{linecolor=blue,arrows=->,arrowscale=2,linewidth=1.5pt,linestyle=solid}