그려진 선이 끝점에 닿지 않음

그려진 선이 끝점에 닿지 않음

두 점을 선으로 연결하는 등의 공사를 하고 있습니다. 어쨌든 K에서 E까지의 첫 번째 줄은 괜찮지만 K에서 M까지의 첫 번째 줄은 그렇지 않습니다. 이 문제를 해결하는 방법은 무엇입니까? 부가 질문: <OBA 각도를 4로 나누는 더 쉬운 방법이 있나요?

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{tikz}
\usepackage{amsmath,amssymb,amsthm,amsfonts,thmtools}
\usepackage[top=1in,bottom=1in,right=1in,left=1in]{geometry}
\usetikzlibrary{tikzmark, shapes, arrows, calc, intersections, through, backgrounds}
\newcommand{\tikzAngleOfLine}{\tikz@AngleOfLine}
\def\tikz@AngleOfLine(#1)(#2)#3{%
    \pgfmathanglebetweenpoints{%
        \pgfpointanchor{#1}{center}}{%
        \pgfpointanchor{#2}{center}}
    \pgfmathsetmacro{#3}{\pgfmathresult}%
}

\begin{document}

\begin{tikzpicture}[scale=12,cap=round,>=latex]

% draw the coordinates
\draw[thin, name path=x] (-0.2cm,0cm) -- (1.1cm,0cm);
\draw[thin, name path=y] (0cm,-0.1cm) -- (0cm,0.4cm);

\coordinate (O) at (0cm,0cm) node[below left=3pt]{$O$};
\coordinate (A) at (1cm,0cm);
\coordinate (B) at (0cm,0.25cm);

\draw[thin] (A) circle(0.1pt) node[below=3pt]{$A$} -- (B) circle(0.1pt) node[left]{$B$};
\tikzAngleOfLine(B)(O){\AngleStart};
\tikzAngleOfLine(B)(A){\AngleEnd};
\pgfmathsetmacro{\alp}{(\AngleEnd+3*\AngleStart)/4};

\draw[thin,red, name path=BE] (B) -- ++(\alp:0.3cm);
\path [name intersections={of=BE and x,by=E}];
\draw (E) circle(0.1pt) node[below left=3pt]{$E$};

\draw[thin,blue, name path=BF] (B) -- ++(\alp-45:0.3cm);
\path [name intersections={of=BF and x,by=F}];
\draw (F) circle(0.1pt) node[below left=3pt]{$F$};

\node (M) [] at ($(F)!0.5!(A)$) {};
\pgfgetlastxy{\xM}{\yM}
\draw (M) circle(0.1pt) node[below left=3pt]{$M$};
\pgfmathsetmacro{\rM}{1-\xM*1pt/1cm*1/12};

\draw[thin, name path=AF] ([shift=(0:\rM)] M) arc (0:180:\rM);

\path[name intersections={of=AF and y,by=K},fill=black];
\draw (K) circle(0.1pt) node[above left=3pt]{$K$};
\draw[thin,green] (K) -- (E); % neatly landing in E
\draw[thin,green] (K) -- (M); % why not landing in M?

\end{tikzpicture}

\end{document}

재판

답변1

여기서 일반적인 대답 \coordinate\node. A는 coordinate실제로 특정 유형의 노드이지만 텍스트 상자처럼 작동하지 않고 단지 점일 뿐입니다. 비어 있는 것에도 \node크기가 있으며 노드에 그려진 선은 노드 경계에서 멈춥니다.

그러나 \coordinate여기서 사용하면 문제가 발생하는 것 같으 \pgfgetlastxy므로 몇 가지 대안은 다음과 같습니다.

  • \path (M);좌표를 지정한 후 추가 :

    \coordinate(M) at ($(F)!0.5!(A)$); \path (M);
    

    그렇게 하면 \pgfgetlastxy올바른 지점을 찾을 수 있습니다.

  • center다음의 앵커 에 그리기 M:

    \draw[thin,green] (K) -- (M.center);
    

관련 정보