
직선과 굽은 선 사이에 각도 알파를 그리려고 합니다. 결과는 아래에서 볼 수 있습니다. 그러나 원하는 결과는 이 각도가 다소 이동하고 약간 구부러져 ∠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의 Metafun 형식에서 일부 기존 매크로를 사용하는 또 다른 MetaPost 대안입니다. 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}