TikZ 교차로에서 'by' 옵션의 의미는 무엇입니까

TikZ 교차로에서 'by' 옵션의 의미는 무엇입니까

PGF 매뉴얼의 65페이지에는 intersectionsTikZ의 라이브러리를 사용한 다양한 작업이 나와 있습니다. 하지만 코드를 이해할 수 없습니다. by여기서 옵션의 의미는 무엇입니까 ?

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

주어진 설명은 다음과 같습니다:

이름 교차점은 좌표에 대한 이름과 그에 대한 옵션을 지정할 수 있는 선택적 인수 by를 사용합니다. 이렇게 하면 더욱 컴팩트한 코드가 생성됩니다.

이것은 명확하지 않습니다.

답변1

관련 라인은

\path [name intersections={of=D and E, by={[label=above:$C$]C, [label=below:$C’$]C’}}];

이 간단한 버전과 비교해 보세요.

\path [name intersections={of=D and E, by={C, C’}}];

여기서 교차점은 계산되어 C와 C'로 명명됩니다("이름그만큼교차로포인트들D와 E의 ~에 의해이름그리고씨'").

에 대한 바로 가기입니다

\coordinate (C) at ...;
\coordinate (C') at ...;

일부 계산된 좌표의 경우.

선택적 스타일을 추가하는 [label=above:$C$]C것은 다음과 같습니다.

\coordinate[label=above:$C$] (C) at ...;

교차점의 스타일을 직접 지정할 수 있습니다. 글을 쓰는 것은 더 길지만 동일합니다.

\path [name intersections={of=D and E, by={C, C’}}];
\node[above] at (C) {$C$};
\node[below] at (C') {$C'$};

답변2

완전성을 위해서입니다. C-1를 사용하여 교차점의 이름을 등으로 지정할 수 있습니다 name=C. 또한 지적할 가치가 있는 점은 직선을 따라 교차점을 정렬하려면곡선인 척 직선을 그려야 해.

\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{intersections}

\begin{document}
\begin{tikzpicture}
    \draw[name path=grid] [xstep=3,ystep=2] (9,8) grid (0,0);
    \draw[->, name path=line] (2,1) to[bend left=0] (7,7);
    \draw[name intersections={of=grid and line, sort by=line, name=C, total=\t}]
        \foreach \s in {1,...,\t}{(C-\s) node {\s}};
\end{tikzpicture}
\end{document}

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

답변3

기본적으로 교차점의 이름은 (intersection-1), (intersection-2)등으로 지정됩니다.

작성하면 by={a,b}처음 두 개의 교차점이 호출 (a)되고 (b).

약간 수정된 142페이지의 예를 살펴보겠습니다. 두 곡선의 9개 교차점을 표시합니다. 총 교차점 수는 로 지정됩니다 total.

를 작성하면 by={a,b}처음 2개의 교차로에는 이제 두 개의 이름이 있습니다.

  • (a)또는(intersection-1)
  • (b)또는(intersection-2)

(a)은(는) 의 별칭이고 (intersection-1)나머지는 별칭이 없으며 액세스 가능한 상태로 유지됩니다.

스크린샷

\documentclass[border=5mm,tikz]{standalone}

\usetikzlibrary{intersections}

\begin{document}
\begin{tikzpicture}
\clip (-2,-2) rectangle (2,2);
\draw [name path=curve 1] (-2,-1) .. controls (8,-1) and (-8,1) .. (2,1);
\draw [name path=curve 2] (-1,-2) .. controls (-1,8) and (1,-8) .. (1,2);
\fill [name intersections={of=curve 1 and curve 2, by={a,b}, total=\t}]
[red, opacity=0.5, every node/.style={above left, black, opacity=1}]
\foreach \s in {1,...,\t}{(intersection-\s) circle (2pt) node {\footnotesize\s}};
\draw[fill=blue!50,opacity=.5] (a) circle (4pt);
\end{tikzpicture}
\end{document}

관련 정보