
나는 존재하지 않는 합동 정리 WWW(AAA?)에 대한 매크로를 구축하려고 합니다. 물론 측면 a를 지정해야 합니다(그런데 SideSideSide는 잘 작동합니다). 누군가 최소한의 실제 사례를 요청했습니다. 질문이 종료되었으므로 질문을 편집하는 것 외에 게시하는 방법을 모르겠습니다. 일부 패키지는 여기에서 쓸모가 없을 수도 있지만 최소화하려고 노력했습니다. 이것은 나에게 잘 작동합니다. 각도를 사용하여 변의 길이를 계산함으로써 내 답변에서 언급한 대로 문제를 해결했습니다. 이제 SSS에 주석이 달린 "클립"이 작동하지 않지만 나중에 이 문제를 수정해 보겠습니다. 질문 편집이 허용되기를 바랍니다.
\documentclass[]{scrartcl}
\usepackage[ngerman]{babel}
\usepackage{amsmath, amssymb} %für logische Symbole
\usepackage{tikz}
\usetikzlibrary{backgrounds}
\usetikzlibrary{decorations.pathmorphing}% Für Wellenlinien u.a.
\usetikzlibrary{automata,positioning} %für Schaltungen
\usetikzlibrary{angles}
\usetikzlibrary{quotes}
\usepackage[RPvoltages, europeanresistors, europeanvoltages]{circuitikz} %für Schaltungen
\usetikzlibrary{calc}
\usetikzlibrary{tikzmark, graphs, intersections}
\usetikzlibrary{mindmap, trees}
\usepackage{mathtools} %wird hier im speziellen benötigt um\abs zu definieren
\usepackage{gensymb}
\usepackage{pgfplotstable}
\usepackage{pgfplots}
\usepackage{pgffor}
\usetikzlibrary{datavisualization}
\usepgfplotslibrary{fillbetween}
\usetikzlibrary{patterns} % Hinzufügen der patterns-Bibliothek
\usepgfplotslibrary{groupplots}
%\usepackage{alphabeta}
\pgfplotsset{compat=1.18}
\usepackage{fp}%für Rechungen mit Variablen
\usepackage[round-mode = places, round-precision = 2]{siunitx}
\newcommand{\SSS}[4][1]{
\begin{tikzpicture}[scale=#1]
% Definiere die Punkte A und B
\coordinate[label=left:$A$] (A) at (0,0);
\coordinate[label=right:$B$] (B) at (#2,0);
% Zeichne die Seite c
\draw[blue] (A) -- (B) node[midway, below] {c = #2};
% Zeichne die Kreise um A und B
\draw[name path=circleA, green] (A) circle (#3);
\draw[name path=circleB, red] (B) circle (#4);
% Finde den Schnittpunkt der beiden Kreise und nenne ihn C
\path[name intersections={of=circleA and circleB, by={C}}];
% Berechne die Winkel
\pgfmathsetmacro\angleA{acos((#2^2+#4^2-#3^2)/(2*#2*#4))}
\pgfmathsetmacro\angleB{acos((#2^2+#3^2-#4^2)/(2*#2*#3))}
\pgfmathsetmacro\angleC{acos((#3^2+#4^2-#2^2)/(2*#3*#4))}
% Runde die Winkel auf volle Grad
\pgfmathround{\angleA}
\let\angleARounded\pgfmathresult
\pgfmathround{\angleB}
\let\angleBRounded\pgfmathresult
\pgfmathround{\angleC}
\let\angleCRounded\pgfmathresult
% Berechne die Höhe
\pgfmathsetmacro\height{#2*sin(\angleA)}
% Setze den Clip-Befehl
%\clip (-1,-1) rectangle (#2+1,\height+1);
% Zeichne die Seiten a und b
\draw[red] (B) -- (C) node[midway, above right] {a = #3};
\draw[green] (C) -- (A) node[midway, above left] {b = #4};
% Zeichne die Winkel
\shorthandoff{"}
\draw pic["$\alpha = \angleARounded^\circ$", draw=orange, <->, pic text options={yshift=0.1cm}, angle eccentricity=0.8, angle radius=1cm] {angle=B--A--C};
\draw pic["$\beta = \angleBRounded^\circ$", draw=orange, <->, pic text options={yshift=0.1cm}, angle eccentricity=0.8, angle radius=1cm] {angle=C--B--A};
\draw pic["$\gamma = \angleCRounded^\circ$", draw=orange, <->, pic text options={yshift=0.1cm}, angle eccentricity=0.8, angle radius=1cm] {angle=A--C--B};
\shorthandon{"}
\end{tikzpicture}
}
\newcommand{\WWW}[5][1]{
% Überprüfe, ob die Summe der Winkel 180° beträgt
\pgfmathparse{#2+#3+#4}
\ifdim\pgfmathresult pt=180pt
\begin{tikzpicture}[scale=#1, transform shape]
% Definiere die Punkte B und C
\coordinate[label=left:$B$] (B) at (0,0);
\coordinate[label=right:$C$] (C) at (#5,0);
% Zeichne die Seite a
\draw[red] (B) -- (C) node[midway, below] {a = #5};
% Berechne die Seiten b und c mit dem Sinussatz
\pgfmathsetmacro\sideB{#5*sin(#3)/sin(#2)}
\pgfmathsetmacro\sideC{#5*sin(#4)/sin(#2)}
\message{Seite a = #5, Seite b = \sideB, Seite c = \sideC}
% Zeichne die Winkelhalbierenden
\pgfmathsetmacro\langesC{\sideC+1}
\pgfmathsetmacro\langesB{\sideB+1}
\draw[name path=angleB, blue] (B) -- ++(#3:\langesC cm);
\draw[name path=angleC, green] (C) -- ++({180-#4}:\langesB cm);
% Finde den Schnittpunkt der beiden Winkel und nenne ihn A
\path[name intersections={of=angleB and angleC, by={A}}];
\node[above] at (A) {$A$};
% Zeichne die Seiten b und c
\draw[blue] (A) -- (B) node[midway, above left] {c = \pgfmathprintnumber{\sideC}};
\draw[green] (A) -- (C) node[midway, above right] {b = \pgfmathprintnumber{\sideB}};
% Zeichne die Innenwinkel
\shorthandoff{"}
\draw pic["$\alpha = #2^\circ$", draw=orange, <->, pic text options={yshift=0.1cm}, angle eccentricity=0.8, angle radius=1cm] {angle=B--A--C};
\draw pic["$\beta = #3^\circ$", draw=orange, <->, pic text options={yshift=0.1cm}, angle eccentricity=0.8, angle radius=1cm] {angle=C--B--A};
\draw pic["$\gamma = #4^\circ$", draw=orange, <->, pic text options={yshift=0.1cm}, angle eccentricity=0.8, angle radius=1cm] {angle=A--C--B};
\shorthandon{"}
\message{Winkel #2 = #2, Winkel #3 = #3, Winkel #4 = #4}
\message{Seite a = #5, Seite b = \sideB, Seite c = \sideC}
\end{tikzpicture}
\else
nicht zu konstruieren
\fi
}
\newcommand{\WSW}[4][1]{%#1=Skalierung #2=beta, #3=a, #4=gamma
% Standardmäßig wird die Seite a gezeichnet, also werden beta und gamma angegeben und alpha wird erstmal berechnet.
\pgfmathsetmacro\alph{180-#2-#4}
\begin{tikzpicture}[scale=#1, transform shape]
% Definiere die Punkte B und C
\coordinate[label=left:$B$] (B) at (0,0);
\coordinate[label=right:$C$] (C) at (#3,0);
% Zeichne die Seite a
\draw[red] (B) -- (C) node[midway, below] {a = #3};
% Berechne die Seiten b und c mit dem Sinussatz
\pgfmathsetmacro\sideB{#3*sin(#2)/sin(\alph)}
\pgfmathsetmacro\sideC{#3*sin(#4)/sin(\alph)}
%\message{Seite a = #4, Seite b = \sideB, Seite c = \sideC}
% Zeichne die Winkelhalbierenden
\pgfmathsetmacro\langesC{\sideC+1}
\pgfmathsetmacro\langesB{\sideB+1}
\draw[name path=angleB, blue] (B) -- ++(#2:\langesC cm);
\draw[name path=angleC, green] (C) -- ++({180-#4}:\langesB cm);
% Finde den Schnittpunkt der beiden Winkelhalbierenden und nenne ihn A
\path[name intersections={of=angleB and angleC, by={A}}];
\node[above] at (A) {$A$};
% Zeichne die Seiten b und c
\draw[blue] (A) -- (B) node[midway, above left] {c = \pgfmathprintnumber{\sideC}};
\draw[green] (A) -- (C) node[midway, above right] {b = \pgfmathprintnumber{\sideB}};
% Zeichne die Innenwinkel
\shorthandoff{"}
\draw pic["$\alpha = \alph^\circ$", draw=orange, <->, pic text options={yshift=0.1cm}, angle eccentricity=0.8, angle radius=1cm] {angle=B--A--C};
\draw pic["$\beta = #2^\circ$", draw=orange, <->, pic text options={yshift=0.1cm}, angle eccentricity=0.8, angle radius=1cm] {angle=C--B--A};
\draw pic["$\gamma = #4^\circ$", draw=orange, <->, pic text options={yshift=0.1cm}, angle eccentricity=0.8, angle radius=1cm] {angle=A--C--B};
\shorthandon{"}
\message{Winkel \alpha = \alph, Winkel \beta = #2, Winkel \gamma = #4}
\message{Seite a = #3, Seite b = \sideB, Seite c = \sideC}
\end{tikzpicture}
}
\begin{document}
\WWW{30}{40}{110}{4}\\
\WSW{50}{5}{60}\\
\SSS{3}{4}{5}\\
\end{document}
답변1
결론: 학위를 활용하라! 나는 복사 및 각도로 여러 번 시도했지만 작동하지 않았습니다. "우연히/무작위로" 해결된 몇 가지 다른 문제가 있는 것 같습니다. 이것은 잘 작동합니다:
\pgfmathsetmacro\sideB{#5*sin(#3)/sin(#2)}
주목 해 주셔서 감사합니다! 인사말 패트릭