三维空间中的矢量投影

三维空间中的矢量投影

我试图找到向量“P”在“P2”上的投影“d”在此处输入图片描述, 任何帮助,将不胜感激。

\documentclass{article}
\usepackage{tikz}   %TikZ is required for this to work.  Make sure this exists before the next line

\usepackage{tikz-3dplot} %requires 3dplot.sty to be in same directory, or in your LaTeX installation
\usepackage[active,tightpage]{preview}  %generates a tightly fitting border around the work
\PreviewEnvironment{tikzpicture}
\setlength\PreviewBorder{2mm}
    \usepackage{xcolor}
    \definecolor{lava}{rgb}{0.81, 0.06, 0.13}
    \definecolor{myblue}{rgb}{0.0, 0.30, 0.60}
    \usetikzlibrary{angles, arrows.meta, quotes}  
  \begin{document}
\tdplotsetmaincoords{60}{110}
\pgfmathsetmacro{\rvec}{.8}
\pgfmathsetmacro{\thetavec}{30}
\pgfmathsetmacro{\phivec}{80}


\begin{tikzpicture}[scale=5,tdplot_main_coords,ang/.style = {draw, Straight Barb-Straight Barb, anchor=west,angle radius = 8mm, angle eccentricity=1},arr/.style = {cap=round,-Straight Barb},]
\coordinate (O) at (0,0,0);
\tdplotsetcoord{P}{\rvec}{\thetavec}{\phivec}

\draw[thick,->] (0,0,0) -- (1,0,0) node[anchor=north east]{$x$};
\draw[thick,->] (0,0,0) -- (0,1,0) node[anchor=north west]{$y$};
\draw[thick,->] (0,0,0) -- (0,0,1) node[anchor=south]{$z$};

 
\draw[-stealth,color=myblue] (O) -- (P);
\tdplotsetcoord{P2}{0.9}{60}{80}
\draw[-stealth,color=myblue] (O) -- (P2);
\tdplotsetcoord{P3}{0.6}{60}{80}
\pic [ang, "$\phi$"] {angle = P2--O--P};
\end{tikzpicture}

\end{document}

答案1

人们可以使用数学公式来推导投影。

P 在 P2 上投影得到的矢量长度为 |P|cos(phi)。

所以\tdplotsetcoord{P5}{0.4*sqrt(3)}{60}{80}(0.8*cos(60-30)) 是 P2 上的投影点。

\begin{tikzpicture}[scale=5,tdplot_main_coords,ang/.style = {draw, Straight Barb-Straight Barb, anchor=west,angle radius = 8mm, angle eccentricity=1},arr/.style = {cap=round,-Straight Barb},]
\coordinate (O) at (0,0,0);
\tdplotsetcoord{P}{\rvec}{\thetavec}{\phivec}

\draw[thick,->] (0,0,0) -- (1,0,0) node[anchor=north east]{$x$};
\draw[thick,->] (0,0,0) -- (0,1,0) node[anchor=north west]{$y$};
\draw[thick,->] (0,0,0) -- (0,0,1) node[anchor=south]{$z$};

 
\draw[-stealth,color=myblue] (O) -- (P);
\tdplotsetcoord{P2}{0.9}{60}{80}
\draw[-stealth,color=myblue] (O) -- (P2);
\tdplotsetcoord{P3}{0.6}{60}{80}
\pic [ang, "$\phi$"] {angle = P2--O--P};

\tdplotsetcoord{P5}{0.4*sqrt(3)}{60}{80}
\draw[-stealth,color=red, dashed] (O) -- (P5);
\end{tikzpicture}

在此处输入图片描述

相关内容