
Ich versuche, einen Winkel Alpha zwischen einer geraden Linie und einer gekrümmten Linie zu zeichnen. Das Ergebnis ist unten zu sehen. Das gewünschte Ergebnis ist jedoch, dass dieser Winkel etwas verschoben und ein wenig gekrümmt ist, damit er zwischen ∠BAC passt.
\documentclass{article}
\usepackage{graphicx}
\usepackage{tikz}
\usepackage{xcolor}
\usetikzlibrary{angles,quotes}
\begin{document}
\begin{figure}[H]
\begin{tikzpicture}[> = stealth]
\coordinate (a) at (0,0);
\coordinate (b) at (3,0);
\coordinate (c) at (3,-1);
\filldraw [gray] (a) circle (2pt)(b) circle (2pt)(c) circle (2pt);
\draw[->] (a) to (b);
\draw[->] (a) [out=7] to (c);
% [out=9]
\node [below] at (0,0) {$A$};
\node [below] at (3,0) {$B$};
\node [below] at (3,-1) {$C$};
% pic[draw, <->, "$\beta$" shift={(-3mm,5mm)}, angle eccentricity=1.2, angle radius=1cm] {angle=a--b--c};
\draw pic[draw,fill=green!30,angle radius=1cm,"foo" shift={(6mm,1mm)}] {angle=c--a--b};
\end{tikzpicture}
\caption{Angle visualised}
\label{fig:offset_visualised}
\end{figure}
\end{document}
Kann mir jemand mit dem Winkel helfen?
Antwort1
Es gibt eine einfache Möglichkeit zum Zeichnen: mithilfe clip
(und ohne Verwendung angles
unserer quotes
Bibliothek).
\documentclass{article}
\usepackage{tikz}
\begin{document}
\begin{figure}[h]
\begin{center}
\begin{tikzpicture}[>=stealth]
\path
(0,0) coordinate (a) node[left]{$A$}
(3,0) coordinate (b) node[right]{$B$}
(3,-2) coordinate (c) node[below]{$C$};
\def\ba{(b)--(a)}
\def\ac{(a) to[out=-10] (c)}
\begin{scope}
\clip \ba--\ac--cycle;
\fill[green] (a) circle(1);
\end{scope}
\foreach \p in {a,b,c} \fill[orange] (\p) circle(2.5pt);
\draw[<-] \ba; \draw[->] \ac;
\end{tikzpicture}
\caption{Angle visualised}
\label{fig:offset_visualised}
\end{center}
\end{figure}
\end{document}
Antwort2
Hier ist eine Alternative (nur zum Vergleich) mitMetapost, zusammengefasst in luamplib
. Hier habe ich die subpath
Notation und Richtungsfunktionen verwendet, um direkt einen Pfad für das farbige Segment zu erstellen, ohne auf Clipping zurückgreifen zu müssen. Kompilieren mit lualatex
.
\documentclass[border=5mm]{standalone}
\usepackage{luatex85}
\usepackage{luamplib}
\begin{document}
\mplibtextextlabel{enable}
\begin{mplibcode}
beginfig(1);
z.A = origin;
z.B = 100 right rotated 10;
z.C = z.B shifted 42 down;
forsuffixes $=A, B, C:
dotlabel.bot("$" & str $ & "$", z$) withcolor 1/2 white;
endfor
path a[];
a1 = z.A -- z.B;
a2 = z.A {z.B-z.A} .. z.C;
numeric a, b;
a = arctime 42 of a1;
b = arctime 42 of a2;
path segment;
segment = subpath (0, b) of a2 {direction b of a2 rotated 90} ..
{direction a of a1 rotated 94} subpath (a, 0) of a1 ..
cycle;
fill segment withcolor 7/8[blue, white];
draw segment withcolor 2/3 blue withpen pencircle scaled 1/4;
interim ahangle := 30;
drawarrow a1;
drawarrow a2;
endfig;
\end{mplibcode}
\end{document}
Antwort3
Eine weitere MetaPost-Alternative, die einige bereits vorhandene Makros aus dem Metafun-Format von MetaPost verwendet. Auch in einem LuaLaTeX-Programm enthalten.
\documentclass[border=2mm]{standalone}
\usepackage{luatex85,luamplib}
\mplibsetformat{metafun}
\mplibtextextlabel{enable}
\begin{document}
\begin{mplibcode}
u = 3cm; pair A, B, C; A = origin; B = (3u,0); C = u*(3,-1);
path p[]; p1 = A -- B; p2 = A{right} .. C;
beginfig(1);
labeloffset := 4.5bp;
forsuffixes P = A, B, C:
drawdot P withcolor .8white withpen pencircle scaled 5bp;
label.bot("$" & str P & "$", P);
endfor;
anglelength := 1.5u;
fill buildcycle(p1, anglebetween(p1, p2, "$\alpha$"), p2) withcolor green;
drawarrow p1; drawarrow p2;
drawarrow anglebetween(p1, p2, "$\alpha$");
endfig;
\end{mplibcode}
\end{document}
Antwort4
Ich bin mir nicht sicher, ob Winkel zwischen gekrümmten Linien überhaupt definiert sind. Hier wird Clipping verwendet, um das gekrümmte Äquivalent zum Winkelbild zu zeichnen und auszufüllen.
Die Alternative bestand darin, Winkel zu berechnen oder zu verwenden \pgfpatharcto
.
\documentclass{standalone}
\usepackage{graphicx}
\usepackage{tikz}
\usepackage{xcolor}
\usetikzlibrary{angles,quotes}
\begin{document}
\begin{tikzpicture}[> = stealth]
\coordinate (a) at (0,0);
\coordinate (b) at (3,0);
\coordinate (c) at (3,-1);
\filldraw [gray] (a) circle (2pt)(b) circle (2pt)(c) circle (2pt);
\draw[->] (a) to (b);
\draw[->] (a) [out=7] to (c);
% [out=9]
\node [below] at (0,0) {$A$};
\node [below] at (3,0) {$B$};
\node [below] at (3,-1) {$C$};
% pic[draw, <->, "$\beta$" shift={(-3mm,5mm)}, angle eccentricity=1.2, angle radius=1cm] {angle=a--b--c};
\begin{scope}
\clip (a) [out=7] to (c) -- (b) -- cycle;
\path[very thin,draw=black,fill=green] (a) circle[radius=1cm];
\end{scope}
%\draw pic[draw,fill=green!30,angle radius=1cm,"foo" shift={(6mm,1mm)}] {angle=c--a--b};
\end{tikzpicture}
\end{document}