为什么 $(O) + ($(X)!(O)!(D)$)$ 投影不正确

为什么 $(O) + ($(X)!(O)!(D)$)$ 投影不正确
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{calc}
\begin{document}
\begin{tikzpicture}
    % Draw the axes 
    \draw[->] (-1,0) -- (7,0) node[right] {$x$}; 
    \draw[->] (0,-1) -- (0,7) node[above] {$y$};
    
    % Define the coordinates
    \coordinate (O) at (0,0);
    \coordinate (X) at (1,5);
    \coordinate (V) at (2,1);
    \coordinate (D) at ($(O) + 5*(V)$);  % 5 times the vector (2,1) added to the origin O
    
    % Compute the projection using the dot product formula
    \coordinate (P) at ($(O) + ($(X)!(O)!(D)$)$);
    %\coordinate (P) at (2.8,1.4); % Adjusted to the projection point

    % Draw the vectors and their projection
    \draw[->, orange, thick] (O) -- (X) node[right] {$\vec{x}$};
    \draw[->, green, thick] (O) -- (D) node[right] {Line L};
    \draw[dashed, red, thick] (X) -- (P);

    % Draw the projection point
    \fill (P) circle (2pt) node[below left] {Projection};

    % Add labels and other features if necessary
\end{tikzpicture}
\end{document}

请告诉我为什么我没有得到 x 在 L 线上的正确投影\coordinate (P) at ($(O) + ($(X)!(O)!(D)$)$) 在此处输入图片描述

当手动计算投影并用下面的线进行调整时,x 在线 L 上的投影是正确的 \coordinate (P) at (2.8,1.4); % Adjusted to the projection point

在此处输入图片描述

相关内容