我希望能够绘制不同角上有直角的不同四边形。我尝试使用相对坐标,但失败了,这是我的 MWE。我还尝试使用直角 -|,但失败了。
\documentclass{amsart}
\usepackage{amsmath}
\usepackage{tikz}
\usetikzlibrary{calc,angles,positioning,intersections,quotes,decorations.markings}
\usepackage{tkz-euclide}% this needed for markings on trianlges with red markings
\usetikzlibrary{shapes,shapes.multipart}
\thispagestyle{empty}
\begin{document}
\begin{tikzpicture}
\draw [help lines] (-3,-3) grid (2,2);
\draw[green,fill=green] (0,0) circle (.5ex);
\draw [color=blue, very thick] (-1,-3) -- (-3,0) -- (-1,2) -- (-30:2cm) --cycle;
\draw [very thick, color= red] (-1.3,1.75) -- (-1,1.4)-- (-0.8,1.8) ;
\end{tikzpicture}
\end{document}
答案1
一个办法
\documentclass{amsart}
\usepackage{amsmath}
\usepackage{tikz}
\usetikzlibrary{calc,angles,positioning,intersections,quotes,decorations.markings}
%\usepackage{tkz-euclide}% this needed for markings on trianlges with red markings
\usetikzlibrary{shapes,shapes.multipart}
\thispagestyle{empty}
\begin{document}
\begin{tikzpicture}
\path[thick,blue] (2,0)coordinate(A) -- (4.5,-3)coordinate(B);
\coordinate(C) at ($(B)!2.5cm!90:(A)$) ;
\coordinate(D) at ($(A)!3cm!-70:(B)$) ;
\draw[thick,blue] (A) -- (B) -- (C) -- (D) -- cycle;
\draw pic[draw,fill=green!30,angle radius=1cm,"$\theta$" shift={(1mm,1mm)}] {angle=A--B--C};
\draw (0,0) grid (5,-5);
\end{tikzpicture}
\end{document}