描画した線が終点に到達しない

描画した線が終点に到達しない

2 つの点を線で結ぶ作図をしています。どういうわけか、K から E への最初の線は OK ですが、K から M への線は OK ではありません。これを解決するにはどうすればよいですか? 副次的な質問ですが、角度 <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。 はcoordinate実際には特定の種類のノードですが、テキスト ボックスのようには機能せず、単なるポイントです。 空であっても\nodeサイズがあり、ノードに描画された線はノードの境界で停止します。

しかし、\coordinateここで を使用すると と混同してしまうような\pgfgetlastxyので、いくつかの代替案があります。

  • \path (M);座標を指定した後に追加します:

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

    そうすれば、\pgfgetlastxy正しいポイントを拾える(と思われる)。

  • centerアンカーへの描画M:

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

関連情報