我正在尝试制作一个非常简单的 tikz 绘图,用于两个向量的正交投影,但我无法制作圆角。有人可以帮我吗?
我当前的代码如下:
\begin{center}
\begin{tikzpicture}[scale=0.2]
\tikzstyle{every node}+=[inner sep=0pt]
\draw [->, line width=1.2] (0,0) -- (30,0);
\draw (22,0) node [below, yshift=-0.3cm] {$u$};
\draw [->, red, line width=1.2] (0,-2) -- (15,-2);
\draw (7.5,-3) node [below, text=red] {$p$};
\draw [->, line width=1.2] (0,0) -- (15,15);
\draw (7.5,7.5) node [above left, yshift=0.5cm] {$v$};
\draw [dotted, line width=0.75] (15,15) -- (15,0);
\draw [black] (13,0) -- (13,2);
\draw [black] (13,2) -- (15,2);
\draw [-, bend left=80] (3,3.5) -- (7,0);
\draw (6,2.5) node [above right] {$\Theta$};
\end{tikzpicture}
\end{center}
绘制结果如下:
答案1
您可以使用calc
投影库和angles
角度库。
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{angles,calc}
\begin{document}
\begin{tikzpicture}[scale=0.2,nodes={inner sep=0pt},>=latex]
\draw [<->, line width=1.2] (30,0) coordinate (u)
-- node[pos=0.3,below=1ex] {$u$} (0,0) coordinate(o)
-- node[pos=0.5,above left=1ex] {$v$} (15,15) coordinate (v);
%
\draw [dotted, line width=0.75] (v) -- ($(o)!(v)!(u)$) coordinate (p);
%
\draw [->, red, line width=1.2] (0,-2) -- node[pos=0.5,below=1ex] {$p$}
($(p)+(0,-2)$);
%
\pic[draw,angle radius=3em,angle eccentricity=1.3,pic text={$\Theta$}]{angle=u--o--v};
\pic[draw,angle radius=1.5em]{right angle=u--p--v};
\end{tikzpicture}
\end{document}