
기본적으로 선의 굵기는 중앙(원래 경로)에서 왼쪽, 오른쪽으로 확산됩니다.이 이미지를 참조하세요, 거기에서 볼 수 있듯이 흰색 선이 원래 경로이고 흰색 선과 겹치는 검은 선이 두께라고 생각하십시오.
내 질문: 두께가 아래로 퍼지는 방향과 위쪽으로 퍼지는 방향을 바꾸는 방법은 무엇입니까?
내가 묻는 이유는 다른 닫힌 경로에 새겨진 닫힌 경로를 그릴 때 다음과 같기 때문입니다.이것. 내부의 닫힌 경로는 원래 경로의 아래쪽 방향으로 두께가 있고 외부는 원래 경로의 위쪽 방향으로 두께가 있으므로 내 이미지가 좋아 보일 것입니다.
MWE:
\documentclass[tikz,border=1mm]{standalone}
\usepackage{bm}
\usetikzlibrary{calc,arrows.meta}
\tikzset{
parallel segment/.style={
segment distance/.store in=\segDistance,
segment pos/.store in=\segPos,
segment length/.store in=\segLength,
to path={
($(\tikztostart)!\segPos!(\tikztotarget)!\segLength/2!(\tikztostart)!\segDistance!90:(\tikztotarget)$) --
($(\tikztostart)!\segPos!(\tikztotarget)!\segLength/2!(\tikztotarget)!\segDistance!-90:(\tikztostart)$) \tikztonodes
},
% Default values
segment pos=.5,
segment length=1cm,
segment distance=-2.5mm,
},
}
\begin{document}
\begin{tikzpicture}[>=Latex]
\coordinate (A) at (0,0);
\coordinate (B) at (7,1);
\coordinate (C) at (3.5,4);
\coordinate (D) at (3.5,.5);
\coordinate (E) at (5.25,2.5);
\coordinate (F) at (1.75,2);
\draw [line width=3pt] (A)--(B)--(C)--cycle
node[] at (1.7,.8){$\bm{C}$};
\draw [line width=3pt] (D)--(E)--(F)--cycle;
\draw[->, line width=1.5pt, red] (A) to[parallel segment] (B);
\draw[->, line width=1.5pt, red] (B) to[parallel segment] (C);
\draw[->, line width=1.5pt, red] (C) to[parallel segment] (A);
\end{tikzpicture}
\end{document}
답변1
가장 쉬운 해결책은 플롯을 자르는 것입니다. 동일한 모양을 사용하여 자르고 그리는 경우 각 선의 안쪽 절반만 표시됩니다.
다음은 단순히 과도한 모서리를 잘라냅니다.
\documentclass[tikz,border=1mm]{standalone}
\usepackage{bm}
\usetikzlibrary{calc,arrows.meta}
\tikzset{
parallel segment/.style={
segment distance/.store in=\segDistance,
segment pos/.store in=\segPos,
segment length/.store in=\segLength,
to path={
($(\tikztostart)!\segPos!(\tikztotarget)!\segLength/2!(\tikztostart)!\segDistance!90:(\tikztotarget)$) --
($(\tikztostart)!\segPos!(\tikztotarget)!\segLength/2!(\tikztotarget)!\segDistance!-90:(\tikztostart)$) \tikztonodes
},
% Default values
segment pos=.5,
segment length=1cm,
segment distance=-2.5mm,
},
}
\begin{document}
\begin{tikzpicture}[>=Latex]
\coordinate (A) at (0,0);
\coordinate (B) at (7,1);
\coordinate (C) at (3.5,4);
\coordinate (D) at (3.5,.5);
\coordinate (E) at (5.25,2.5);
\coordinate (F) at (1.75,2);
\draw [line width=3pt] (A)--(B)--(C)--cycle
node[] at (1.7,.8){$\bm{C}$};
\begin{scope}
\clip (A)--(B)--(C)--cycle;
\draw [line width=3pt] (D)--(E)--(F)--cycle;
\end{scope}
\draw[->, line width=1.5pt, red] (A) to[parallel segment] (B);
\draw[->, line width=1.5pt, red] (B) to[parallel segment] (C);
\draw[->, line width=1.5pt, red] (C) to[parallel segment] (A);
\end{tikzpicture}
\end{document}