繪製一個直角四邊形

繪製一個直角四邊形

我希望能夠在不同的角上繪製具有直角的不同的四邊形。我嘗試使用相對坐標但失敗了,這是我的 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}

在此輸入影像描述

相關內容