forked from miloyip/light2d
-
Notifications
You must be signed in to change notification settings - Fork 0
/
linesegmentpointdistance.tex
34 lines (31 loc) · 1.52 KB
/
linesegmentpointdistance.tex
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
\documentclass[tikz]{standalone}
\usetikzlibrary{arrows,angles,quotes,calc}
\begin{document}
\begin{tikzpicture}[>=triangle 45,line width=1pt,scale=1.0,font=\fontsize{10pt}{0}]
\begin{scope}
\coordinate (A) at (0,0);
\coordinate (B) at (4,2);
\coordinate (C) at (2,3);
\node[fill,inner sep=2pt,circle,label=135:$\mathbf{a}$] at (A) {};
\node[fill,inner sep=2pt,circle,label=135:$\mathbf{b}$] at (B) {};
\node[fill,inner sep=2pt,circle,label=$\mathbf{x}$] at (C) {};
\draw[->] (A) -- (B) node[midway, anchor=south east] {$\mathbf{u}$};
\draw[->,dashed] (A) -- (C) node[midway, anchor=south east] {$\mathbf{v}$};
\draw[dashed] ($(A)!-0.2!(B)$) -- ($(A)!1.2!(B)$);
\draw[dashed, blue](C) -- ($(A)!0.72!(B)$) node[midway, anchor=west] {$d$} node[fill,inner sep=2pt,circle,label=-90:$\mathbf{x}'$] {};
\end{scope}
\begin{scope}[xshift=7cm]
\coordinate (A) at (0,0);
\coordinate (B) at (4,2);
\coordinate (C) at (4.5,4);
\node[fill,inner sep=2pt,circle,label=135:$\mathbf{a}$] at (A) {};
\node[fill,inner sep=2pt,circle,label=135:$\mathbf{b}$] at (B) {};
\node[fill,inner sep=2pt,circle,label=$\mathbf{x}$] at (C) {};
\draw[->] (A) -- (B) node[midway, anchor=north west] {$\mathbf{u}$};
\draw[->,dashed] (A) -- (C) node[midway, anchor=south east] {$\mathbf{v}$};
\draw[dashed] ($(A)!-0.2!(B)$) -- ($(A)!1.3!(B)$);
\draw[dashed](C) -- ($(A)!1.3!(B)$);
\draw[dashed, blue](C) -- (B) node[midway, anchor=west] {$d$} node[fill,inner sep=2pt,circle,label=-90:$\mathbf{x}'$] {};
\end{scope}
\end{tikzpicture}
\end{document}