
直線と曲げ線の間に角度 alpha を描画しようとしています。結果は下図のようになります。ただし、望ましい結果は、この角度が多少ずれて少し曲がって、∠BAC の間に収まるようにすることです。
\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}
角度について誰か手伝ってくれませんか?
答え1
描画する簡単な方法があります: を使用する(またはライブラリclip
を使用しない)。angles
quotes
\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}
答え2
比較のために、別の方法を紹介します。メタポストは で囲まれていますluamplib
。ここでは、表記法と方向機能を使用して、subpath
クリッピングに頼らずに色付きセグメントのパスを直接構築しています。 でコンパイルします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}
答え3
MetaPost のもう 1 つの代替手段。MetaPost の Metafun 形式の既存のマクロを使用します。LuaLaTeX プログラムにも含まれています。
\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}
答え4
曲線間の角度が定義されているかどうかはわかりません。これは、クリッピングを使用して、角度の写真に相当する曲線を描画および塗りつぶします。
代わりに、角度を計算するか、 を使用します\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}