Tikz: Tikz 스타일의 각도 표시를 위한 다양한 방법

Tikz: Tikz 스타일의 각도 표시를 위한 다양한 방법

이 아름다운 대답을 계속해서,다음과 같은 추가 각도 표시가 가능합니까? ((1) 중앙에 점이 있는 각도, (2) 가능하면 사용자 정의할 수 있는 장식이 있는 보라색 각도(세그먼트 번호, 길이, 거리, 색상 등), (3) 각도 여러 호.

여기에 이미지 설명을 입력하세요

답변1

여기에 제안이 있습니다. Kpym이 댓글에서 친절하게 설명했듯이 각도 구성에는 호와 채우기라는 두 가지 경로가 있습니다. Ti를 예방해야 한다케이Z는 장식을 두 번 그렸습니다. 이 답변은 style 과 함께 제공되는데 insert angle lines, 이는 두 개의 인수, 즉 선 수와 연결해야 하는 꼭지점을 취합니다. 예는 다음과 같습니다

\pic [draw=red,angle radius=1cm,insert angle lines={3}{A}] 
    {angle = C--A--B};

점에 대한 두 번째 스타일이 있습니다

\pic [draw=blue,angle radius=1cm,insert angle dot={B}] {angle = A--B--C};

이러한 마크의 스타일을 변경하려면 을 조정하십시오 every angle mark. 다음은 MWE입니다.

\documentclass[tikz,border=10pt]{standalone}
\usetikzlibrary{decorations.markings,angles}
\newcounter{trstep}
\begin{document}
\tikzset{insert |/.style={decoration={markings,
  mark=at position #1 with {%
   \draw[line cap=round,mark segment] 
    (0,-\pgfkeysvalueof{/tikz/mark
    segment length}/2) -- (0,\pgfkeysvalueof{/tikz/mark
    segment length}/2);}
  }},
  | mark/.style={postaction=decorate,insert |=#1},
  insert ||/.style={decoration={markings,
  mark=at position #1 with {%
   \draw[line cap=round,mark segment] 
    (-\pgfkeysvalueof{/tikz/mark segment distance}/2,-\pgfkeysvalueof{/tikz/mark
    segment length}/2) -- (-\pgfkeysvalueof{/tikz/mark segment distance}/2,\pgfkeysvalueof{/tikz/mark
    segment length}/2);
   \draw[line cap=round,mark segment] (\pgfkeysvalueof{/tikz/mark segment distance}/2,-\pgfkeysvalueof{/tikz/mark
    segment length}/2) -- (\pgfkeysvalueof{/tikz/mark segment distance}/2,\pgfkeysvalueof{/tikz/mark
    segment length}/2);}
  }},
  || mark/.style={postaction=decorate,insert ||=#1},
 insert |||/.style={decoration={markings,
  mark=at position #1 with {%
   \draw[line cap=round,mark segment] 
    (-\pgfkeysvalueof{/tikz/mark segment distance},-\pgfkeysvalueof{/tikz/mark
    segment length}/2) -- (-\pgfkeysvalueof{/tikz/mark segment distance},\pgfkeysvalueof{/tikz/mark
    segment length}/2);
   \draw[line cap=round,mark segment] 
    (0,-\pgfkeysvalueof{/tikz/mark
    segment length}/2) -- (0,\pgfkeysvalueof{/tikz/mark
    segment length}/2); 
   \draw[line cap=round,mark segment] 
   (\pgfkeysvalueof{/tikz/mark segment distance},-\pgfkeysvalueof{/tikz/mark
    segment length}/2) -- (\pgfkeysvalueof{/tikz/mark segment distance},\pgfkeysvalueof{/tikz/mark
    segment length}/2);}
  }},
  ||| mark/.style={postaction=decorate,insert |||=#1},
 mark segment/.style={thick},
 mark segment options/.code=\tikzset{mark segment/.style={#1}},
 mark segment distance/.initial=2pt,
 mark segment length/.initial=4pt,
 angle deco |/.style={insert |=0.5,
      pic actions/.append code=\tikzset{postaction=decorate}},
 angle deco ||/.style={insert ||=0.5,
      pic actions/.append code=\tikzset{postaction=decorate}},
 angle deco |||/.style={insert |||=0.5,
      pic actions/.append code=\tikzset{postaction=decorate}},
 insert angle lines/.style n args={2}{
 /utils/exec={\pgfmathsetmacro{\mystep}{1/(#1+1)}
 \setcounter{trstep}{0}},
 decoration={markings,mark=between positions {\mystep} and {1-\mystep} step {\mystep}
 with {\stepcounter{trstep}
 \ifnum\number\value{trstep}>#1
 \else
  \draw[shorten <=-1pt,every angle mark] (0,0)-- (#2);
  \fi}},
 pic actions/.append code=\tikzset{postaction={decorate}}
 },
 every angle mark/.style={line cap=round,semithick},
 double arc/.style={double,double distance=2pt},
 triple arc/.style={double distance=4pt,
    pic actions/.append code=\tikzset{postaction={draw}}},
 insert angle dot/.style={
 /utils/exec={\setcounter{trstep}{0}},
 decoration={markings,mark=at position 0.5  with {\stepcounter{trstep}
 \ifnum\number\value{trstep}=1
  \fill[\pgfkeysvalueof{/tikz/angle dot color}] (#1) -- (0,0)  coordinate[pos=\pgfkeysvalueof{/tikz/angle dot pos}] (aux) (aux) 
  circle[radius=\pgfkeysvalueof{/tikz/angle dot radius}];
  \fi}},
 pic actions/.append code=\tikzset{postaction={decorate}}},
 angle dot radius/.initial=1pt,
 angle dot pos/.initial=0.6,
 angle dot color/.initial=black}

\begin{tikzpicture}[]
    \coordinate (A) at (0,0);
    \coordinate (B) at (2,4);
    \coordinate (C) at (4,0);

    \draw(A)--(B)--(C)--cycle;
    \path[| mark=0.5] (A) -- (B);
    \path[mark segment options={thick,yscale=2},|| mark=0.5] (B) -- (C);
    \path[mark segment options={blue,line width=1pt,scale=2},||| mark=0.5] (C) -- (A);
    \pic [draw=blue,angle radius=1cm,insert angle dot={B}] 
    {angle = A--B--C};
    \pic [draw=red,angle radius=1cm,insert angle lines={3}{A}] 
    {angle = C--A--B};
    \pic [draw=purple,angle radius=1cm,triple arc,
    insert angle lines={3}{C}] 
    {angle = B--C--A};
\end{tikzpicture}
\end{document}

여기에 이미지 설명을 입력하세요

관련 정보