Sphärisches Dreieck zeichnen
Hallo liebe Community,
ich habe mich daran versucht dieses Bild in Ticks zu zeichnen.
[![alt text][1]][2]
Was mir einfach nicht gelingen will ist die Fläche zu Färben. Der karierte Hintergrund ist mir nicht wichtig, aber ich muss irgendwie kennzeichnen, dass alle drei Winkel rechte Winkel sind. Hier mein Codebeispiel bis zum jetzigen Stand. Vielleicht hat jemand eine smartere Idee, weil ich bestimmt zu verkauft herangehe.
\documentclass {standalone}
\usepackage {tikz}
\usetikzlibrary{3d}
\usetikzlibrary{calc}
\usetikzlibrary{math}
\usetikzlibrary{calc,patterns,angles,quotes}
\usepackage{tkz-euclide}
% isometric axes
\pgfmathsetmacro\xx{1/sqrt(2)}
\pgfmathsetmacro\xy{1/sqrt(6)}
\pgfmathsetmacro\zy{sqrt(2/3)}
% some functions (cross products)
\tikzmath%
{%
function crossx(\mx,\my,\mz,\nx,\ny,\nz)
{% cross product, x coordinate, normailized
\pxx = \my*\nz-\mz*\ny;
\pyy = \mz*\nx-\mx*\nz;
\pzz = \mx*\ny-\my*\nx;
return {\pxx/sqrt(\pxx*\pxx+\pyy*\pyy+\pzz*\pzz)};
};
function crossy(\mx,\my,\mz,\nx,\ny,\nz)
{% cross product, y coordinate, normailized
\pxx = \my*\nz-\mz*\ny;
\pyy = \mz*\nx-\mx*\nz;
\pzz = \mx*\ny-\my*\nx;
return {\pyy/sqrt(\pxx*\pxx+\pyy*\pyy+\pzz*\pzz)};
};
function crossz(\mx,\my,\mz,\nx,\ny,\nz)
{% cross product, z coordinate, normailized
\pxx = \my*\nz-\mz*\ny;
\pyy = \mz*\nx-\mx*\nz;
\pzz = \mx*\ny-\my*\nx;
return {\pzz/sqrt(\pxx*\pxx+\pyy*\pyy+\pzz*\pzz)};
};
}
\newcommand{\greatcircle}[6] % pole x, y, z, color, two orientation factors (+1/-1)
{%
\coordinate (P) at (#1,#2,#3); % pole
\coordinate (N) at ($(0,0,0)!#6*1.25cm!(P)$); % these points are
\coordinate (S) at ($-1*(N)$); % used to clip the
\coordinate (E) at ($(0,0,0)!-1.25cm!270:(P)$); % ellipses
\coordinate (W) at ($-1*(E)$); % ...
\coordinate (NW) at ($(N)+(W)$);
\coordinate (NE) at ($(N)+(E)$);
\coordinate (SW) at ($(S)+(W)$);
\coordinate (SE) at ($(S)+(E)$);
\pgfmathsetmacro\ptheta{atan(#2/#1)} % pole, spherical coordinate theta
\pgfmathsetmacro\pphi {#5*acos(#3)} % pole, spherical coordinate phi
\begin{scope}
\clip (W) -- (SW) -- (SE) -- (E) -- cycle;
\draw[rotate around z=\ptheta,rotate around y=\pphi,%
canvas is xy plane at z=0,#4] (0,0) circle (1);
\end{scope}
\begin{scope}
\clip (W) -- (NW) -- (NE) -- (E) -- cycle;
\draw[rotate around z=\ptheta,rotate around y=\pphi,%
canvas is xy plane at z=0,#4,densely dotted] (0,0) circle (1);
\end{scope}
}
\begin{document}
\begin{tikzpicture}[line cap=round,line join=round,scale=2,%
x={({-\xx cm,-\xy cm})},y={(\xx cm,-\xy cm)},z={(0 cm,\zy cm)}]
% points A, B, C in spherical coordinates
\def\atheta{55}
\def\aphi {30}
\def\btheta{10}
\def\bphi {85}
\def\ctheta{70}
\def\cphi {80}
% points A, B, C in cartesian coordinates
\pgfmathsetmacro\ax{cos(\atheta)*sin(\aphi)}
\pgfmathsetmacro\ay{sin(\atheta)*sin(\aphi)}
\pgfmathsetmacro\az{cos(\aphi)});
\pgfmathsetmacro\bx{cos(\btheta)*sin(\bphi)}
\pgfmathsetmacro\by{sin(\btheta)*sin(\bphi)}
\pgfmathsetmacro\bz{cos(\bphi)});
\pgfmathsetmacro\cx{cos(\ctheta)*sin(\cphi)}
\pgfmathsetmacro\cy{sin(\ctheta)*sin(\cphi)}
\pgfmathsetmacro\cz{cos(\cphi)});
% polar points P, Q, R in cartesian coordinates
\pgfmathsetmacro\px{crossx(\ax,\ay,\az,\bx,\by,\bz)}
\pgfmathsetmacro\py{crossy(\ax,\ay,\az,\bx,\by,\bz)}
\pgfmathsetmacro\pz{crossz(\ax,\ay,\az,\bx,\by,\bz)}
\pgfmathsetmacro\qx{crossx(\cx,\cy,\cz,\ax,\ay,\az)}
\pgfmathsetmacro\qy{crossy(\cx,\cy,\cz,\ax,\ay,\az)}
\pgfmathsetmacro\qz{crossz(\cx,\cy,\cz,\ax,\ay,\az)}
\pgfmathsetmacro\rx{crossx(\bx,\by,\bz,\cx,\cy,\cz)}
\pgfmathsetmacro\ry{crossy(\bx,\by,\bz,\cx,\cy,\cz)}
\pgfmathsetmacro\rz{crossz(\bx,\by,\bz,\cx,\cy,\cz)}
% triangles
\greatcircle{\px}{\py}{\pz}{black}{-1}{1}
\greatcircle{\qx}{\qy}{\qz}{black}{ 1}{1}
\greatcircle{\rx}{\ry}{\rz}{black}{-1}{1}
% sphere and axes
\draw (0,0,0) circle (1 cm);
\coordinate (A) at (\ax,\ay,\az);
\coordinate (B) at (\bx,\by,\bz);
\coordinate (C) at (\cx,\cy,\cz);
\node[above] at (0.5,1,0.7) {$a$};
\node[above] at (0.5,0,0.2) {$b$};
\node[above] at (0.5,0.4,-0.3) {$c$};
\pic [draw, "$\alpha$", angle eccentricity=1.5, radius=0.3cm] {angle = C--B--A};
\pic [draw, "$\beta$", angle eccentricity=1.5] {angle = A--C--B};
\pic [draw, "$\gamma$", angle eccentricity=1.5] {angle = B--A--C};
\filldraw[fill=blue,fill opacity=0.5](A)--(B)--(C)--cycle;
% points
\fill[black] (\ax,\ay,\az) circle (0.5pt) node [above] {$C$};
\fill[black] (\bx,\by,\bz) circle (0.5pt) node [below] {$A$};
\fill[black] (\cx,\cy,\cz) circle (0.5pt) node [below left] {$B$};
\end{tikzpicture}
\end{document}
Vielen Dank schon einmal im Voraus für jeden Rat der mir weiterhilft.
EDIT:
Das kommt bei mir in der Ausgabe heraus:
[![alt text][3]][3]
[1]: https://texwelt.de/upfiles/Bild4.png
[2]: https://texwelt.de/upfiles/Bild4.png
[3]: https://texwelt.de/upfiles/Bildschirmfoto_2024-10-12_um_15.42.45.pnghttps://texwelt.de/upfiles/Bildschirmfoto_2024-10-12_um_15.42.45_1.png