I would like to draw this picture:
The triangle ABC is a spherical one.
How can I do this using TikZ?
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It only takes a minute to sign up.
Sign up to join this communityHere is an example made in 3d. I put in it some parameters, but it's not so very flexible. That was to avoid too long trigonometric calculations. The circles can be drawn using the canvas
and rotate around
options, and clipping them.
This is the code:
\documentclass[border=2mm]{standalone}
\usepackage {tikz}
\usetikzlibrary{3d}
\usetikzlibrary{calc}
\def\xx{0.5} % reduction x axis, cavalier perspective
\def\aa{30} % angles AOB=BOC
\def\r {3} % radius
\def\l {4.5} % distance AD=AE
\pgfmathsetmacro\ay{\r*cos(\aa)} % Coordinates A
\pgfmathsetmacro\az{\r*sin(\aa)}
\pgfmathsetmacro\cx{\r*sin(\aa)} % Coordinates C
\pgfmathsetmacro\cy{\r*cos(\aa)}
\pgfmathsetmacro\nx{-sin(\aa)*cos(\aa)} % normal vector OAC plane
\pgfmathsetmacro\ny{ sin(\aa)*sin(\aa)}
\pgfmathsetmacro\nn{sqrt(2*\nx*\nx+\ny*\ny)} % modulus
\pgfmathsetmacro\ap{acos(abs(\nx)/\nn)} % angle between planes XY and OAC
\begin{document}
\begin{tikzpicture}[line cap=round,line join=round,x={(-\xx cm,-\xx cm)},y={(1 cm,0 cm)},z={(0 cm,1 cm)}]
% coordinates
\coordinate (O) at (0,0,0);
\coordinate (A) at (0,\ay,\az);
\coordinate (B) at (0,\r,0);
\coordinate (C) at (\cx,\cy,0);
\coordinate (D) at (0,\l,0);
\coordinate (E) at ({\l*sin(\aa)},{\l*cos(\aa)},0);
% labels
\node at (O) [left] {$O$};
\node at (A) [above] {$A$};
\node at (B) [below] {$B$};
\node at (C) [below] {$C$};
\node at (D) [below] {$D$};
\node at (E) [below] {$E$};
\node[red] at ($(B)!0.5!(C)$) [below] {$a$};
\node[red] at ($(A)!0.5!(C)$) {$b$};
\node[red] at ($(A)!0.5!(B)$) [right] {$c$};
% spheric triangle
\begin{scope} [canvas is xy plane at z=0]
\clip (O) -- (D) -- (E) -- cycle;
\draw[red] (O) circle (\r);
\end{scope}
\begin{scope}[canvas is yz plane at x=0]
\clip (O) -- (A) -- (D) -- cycle;
\draw[red] (O) circle (\r);
\end{scope}
\begin{scope}[rotate around z=-\aa, rotate around y=\ap-90,canvas is yz plane at x=0]
\clip (O) -- (A) -- (E) -- cycle;
\draw[red] (O) circle (\r);
\end{scope}
% lines
\draw (O) -- (A) -- (D) -- (E) -- cycle;
\draw[dashed] (O) -- (D);
\draw (A) -- (E);
\end{tikzpicture}
\end{document}
You can use tikz-3dplot
.
\documentclass[tikz,border=3mm]{standalone}
\usepackage{tikz-3dplot}
\begin{document}
\tdplotsetmaincoords{70}{35}
\begin{tikzpicture}[tdplot_main_coords,line cap=round,line join=round,
declare function={Px=0.2;Py=0.4;Pz=0.6;}]
\draw (0,0,0) coordinate[label=left:{$O$}] (O)
(2,0,0) coordinate[label=below:{$A$}] (A) edge (O)
-- (2,2,0) coordinate[label=below:{$B$}] (B) edge (O)
-- (2,1,2) coordinate[label=above:{$C$}] (C) edge (O)
-- (A)
-- (3,0,0) coordinate[label=below:{$E$}] (E) edge (C)
-- (3,3,0) coordinate[label=right:{$D$}] (D) edge (C)
-- (B);
\end{tikzpicture}
\end{document}