TikZ를 사용한 계산

TikZ를 사용한 계산

값이 올바르게 계산되지 않는 이유를 이해할 수 없습니다. 뭐가 문제 야? 두 화살표의 각도(시작 및 끝)는 동일해야 합니다.

\documentclass[10pt]{article}
\usepackage[a4paper,top=1in, bottom=1in, left=1in, right=1in]{geometry}
\usepackage{tikz}
\usetikzlibrary{calc,arrows.meta,bending,decorations.text,positioning}

\def\centerarct[#1](#2)(#3:#4:#5)% Syntax: [draw options] (center) (start angle:end angle:radius)
{ \path[#1] ($(#2)+({#5*cos(-#3+90)},{#5*sin(-#3+90)})$) arc [start angle={-#3+90}, end angle={-#4+90}, radius=#5)]; }

\def\vectorl[#1](#2)(#3:#4:#5:#6)% Syntax: [draw options] (center) (total:start:end:radius)
{ \centerarct[#1](#2)({#5/#3*360}:{(#4-1)/#3*360+360}:#6); }

\begin{document}
 \begin{tikzpicture}
  \vectorl[draw=yellow!75!white,line width=5mm](0,0)(2500:1:2500:4.75);
  \centerarct[{Triangle[width=9mm,length=5mm]}-,scale=1.175,draw=violet!75!white,line width=5mm, postaction={decorate,decoration={text along path,text align={center,left indent=2.5mm},text={Test},raise=-1.25mm}}](0,0)(345.6:374.4:4.75);
  \vectorl[{Triangle[width=9mm,length=5mm]}-,scale=1.4,draw=violet!75!white,line width=5mm, postaction={decorate,decoration={text along path,text align={center,left indent=2.5mm},text={Test},raise=-1.25mm}}](0,0 )(2500:101:2400:4.75);  
 \end{tikzpicture}
\end{document}

답변1

start angle={-#3+90}예를 들어 in 이 있으므로 \centerarct의 정의에 추가 괄호 쌍이 필요합니다 . 그렇지 않으면 대신 , \vectorl을 얻게 됩니다 . 즉, .-x+360+90-(x+360)+90{((#4-1)/#3*360+360)}

하지만 사물이 정의되는 방식으로 인해 노란색 원의 시작/끝 값 순서를 바꿔야 합니다.

\documentclass[10pt]{article}
\usepackage[a4paper,top=1in, bottom=1in, left=1in, right=1in]{geometry}
\usepackage{tikz}
\usetikzlibrary{calc,arrows.meta,bending,decorations.text,positioning}

\def\centerarct[#1](#2)(#3:#4:#5)% Syntax: [draw options] (center) (start angle:end angle:radius)
{ \path[#1] ($(#2)+({#5*cos(-#3+90)},{#5*sin(-#3+90)})$) arc [start angle={-#3+90}, end angle={-#4+90}, radius=#5)]; }

\def\vectorl[#1](#2)(#3:#4:#5:#6)% Syntax: [draw options] (center) (total:start:end:radius)
{ \centerarct[#1](#2)({#5/#3*360}:{((#4-1)/#3*360+360)}:#6); }

\begin{document}
\begin{tikzpicture}
  \vectorl[draw=yellow!75!white,line width=5mm](0,0)(2500:2500:1:4);

  \centerarct[{Triangle[width=9mm,length=5mm]}-,draw=violet!75!white,line width=5mm, postaction={decorate,decoration={text along path,text align={center,left indent=2.5mm},text={Test},raise=-1.25mm}}](0,0)(345.6:374.4:5);

  \vectorl[{Triangle[width=9mm,length=5mm]}-,draw=violet!75!white,line width=5mm, postaction={decorate,decoration={text along path,text align={center,left indent=2.5mm},text={Test},raise=-1.25mm}}](0,0)(2500:101:2400:6);  

\end{tikzpicture}
\end{document}

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

관련 정보