TikZ에서 잘못된 교차점 얻기

TikZ에서 잘못된 교차점 얻기

목적은 삼각형의 세 각의 이등분선을 모두 그리는 것입니다. 여기서 ABC는 삼각형입니다. (a1,a2), (b1,b2) 및 (c1,c2) ​​쌍은 각각 정점 A, B 및 C에서 호의 시작점과 끝점을 나타냅니다. 내가 하려는 것은 A -- ($(a1)!0.5!(a2)$) 선과 해당 변 BC를 선택하여 교차점(예: k1)을 구하는 것입니다. 그런 다음 꼭지점과 교차점 k1을 사용하여 각도 이등분선을 그립니다. 그리고 나머지 두 정점에 대해 이를 반복합니다. 하지만 내 문제는 선의 교차점을 얻으려고 할 때 점 c1을 얻는다는 것입니다.

내 코드는 다음과 같습니다.

\documentclass[11pt,a4paper]{article}

\usepackage[margin=0.75in,marginparsep=0pt]{geometry}

\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{lmodern}

\usepackage{tikz}
\usetikzlibrary{calc,intersections}


\begin{document}
\begin{tikzpicture}
% vertices of the triangle
\coordinate[label=below:{$A(x_1,y_1)$}] (A) at (0,0);
\coordinate[label=below:{$B(x_2,y_2)$}] (B) at (4.5cm, 0);
\coordinate[label=above:{$C(x_3,y_3)$}] (C) at (6cm, 5cm);

% drawing triangle
\draw[name path=trg] (A) -- (B) -- (C) -- cycle;

% circle at each vertex A, B and C to get intersection
% points with triangle
\path[name path=circa] (A) circle (6mm);
\path[name path=circb] (B) circle (6mm);
\path[name path=circc] (C) circle (6mm);

% labeling intersections of circles and each vertex angle
\path [name intersections={of=trg and circa, by={a1,a2}}]; % at vertex A
\path [name intersections={of=trg and circb, by={b1,b2}}]; % at vertex B
\path [name intersections={of=trg and circc, by={c1,c2}}]; % at vertex C


% drawing arc at each vertex
\draw[bend right] (a1) to (a2);
\draw[bend right] (b2) to (b1);
\draw[bend right] (c2) to (c1);

\path[name path=AB] (A) -- (B);
\path[name path=BC] (B) -- (C);
\path[name path=CA] (C) -- (A);

% determining intersection of angle bisector and 
% corresponding side of the triangles
\path[name path=abs1] (A) -- ($(a1)!0.5!(a2)$);
\path[name intersections={of=abs1 and BC, by={k1}}];
\fill[red] (k1) circle [radius=2pt];

\path[name path=abs2] (B) -- ($(b1)!0.5!(b2)$);
\path[name intersections={of=abs2 and CA, by={k2}}];
\fill[red] (k2) circle [radius=2pt];

\path[name path=abs3] (C) -- ($(c1)!0.5!(c2)$);
\path[name intersections={of=abs3 and AB, by={k3}}];
\fill[red] (k3) circle [radius=2pt];

% drawing angle bisectors
% the problem is that k1, k2, and k3 are at the same place
\draw [red] (A) -- (k1); 
\draw [red] (B) -- (k2);
\draw [red] (C) -- (k3);
\end{tikzpicture}


\end{document}

답변1

세그먼트 abs1와 세그먼트에는 BC교차점이 없습니다... abs1세그먼트를 다음과 같이 확대할 수 있습니다.

\path[overlay,name path=abs1] (A) -- ($(A)!20!($(a1)!0.5!(a2)$)$);

바운딩박스 계산에 방해가 되지 않도록 임의로 값을 선택 20하고 옵션을 추가합니다 .overlay

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

\documentclass[]{standalone}

\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{lmodern}

\usepackage{tikz}
\usetikzlibrary{calc,intersections}


\begin{document}
\begin{tikzpicture}
% vertices of the triangle
\coordinate[label=below:{$A(x_1,y_1)$}] (A) at (0,0);
\coordinate[label=below:{$B(x_2,y_2)$}] (B) at (4.5cm, 0);
\coordinate[label=above:{$C(x_3,y_3)$}] (C) at (6cm, 5cm);

% drawing triangle
\draw[name path=trg] (A) -- (B) -- (C) -- cycle;

% circle at each vertex A, B and C to get intersection
% points with triangle
\path[name path=circa] (A) circle (6mm);
\path[name path=circb] (B) circle (6mm);
\path[name path=circc] (C) circle (6mm);

% labeling intersections of circles and each vertex angle
\path [name intersections={of=trg and circa, by={a1,a2}}]; % at vertex A
\path [name intersections={of=trg and circb, by={b1,b2}}]; % at vertex B
\path [name intersections={of=trg and circc, by={c1,c2}}]; % at vertex C


% drawing arc at each vertex
\draw[bend right] (a1) to (a2);
\draw[bend right] (b2) to (b1);
\draw[bend right] (c2) to (c1);

\path[name path=AB] (A) -- (B);
\path[name path=BC] (B) -- (C);
\path[name path=CA] (C) -- (A);

% determining intersection of angle bisector and 
% corresponding side of the triangles
\path[overlay,name path=abs1] (A) -- ($(A)!20!($(a1)!0.5!(a2)$)$);
\path[name intersections={of=abs1 and BC, by={k1}}];
\fill[red] (k1) circle [radius=2pt];

\path[overlay,name path=abs2] (B) -- ($(B)!20!($(b1)!0.5!(b2)$)$);
\path[name intersections={of=abs2 and CA, by={k2}}];
\fill[red] (k2) circle [radius=2pt];

\path[overlay,name path=abs3] (C) -- ($(C)!15!($(c1)!0.5!(c2)$)$);
\path[name intersections={of=abs3 and AB, by={k3}}];
\fill[red] (k3) circle [radius=2pt];

% drawing angle bisectors
% the problem is that k1, k2, and k3 are at the same place
\draw [red] (A) -- (k1); 
\draw [red] (B) -- (k2);
\draw [red] (C) -- (k3);
\end{tikzpicture}


\end{document}

관련 정보