2

I am trying to draw a pentagon. The point A_1 is at the origin, and the point A_2 is at (60:1.75), expressed in polar coordinates. I would like A_3 to be 0.5cm from A_2 and perpendicular to line segment $\overline{A_1A_2}$, A_4 to be 1cm from A_3 and rotated 120 degrees from line segment $\overline{A_2A_3}$, and A_5 to be 0.75 cm from A_4 and rotated 120 degrees from line segment $\overline{A_3A_4}$. That is not what is drawn.

\documentclass{amsart}
\usepackage{amsmath}
\usepackage{amsfonts}

\usepackage{tikz}
\usetikzlibrary{calc,angles,positioning,intersections}


\begin{document}



\noindent \hspace*{\fill}
\begin{tikzpicture}

\path (0,0) coordinate (A_1)
(60:1.75) coordinate (A_2)
($(A_2) +($(A_2)!0.5cm!90:(A_1)$)$) coordinate (A_3)
($(A_3) +($(A_3)!1cm!120:(A_2)$)$) coordinate (A_4)
($(A_4) +($(A_4)!0.75cm!120:(A_3)$)$) coordinate (A_5);
\draw (A_1) -- (A_2) -- (A_3) -- (A_4) -- (A_5) -- cycle;

\draw[fill] (A_1) circle (1.5pt);
\draw[fill] (A_2) circle (1.5pt);
\draw[fill] (A_3) circle (1.5pt);
\draw[fill] (A_4) circle (1.5pt);
\draw[fill] (A_5) circle (1.5pt);


\end{tikzpicture}
\end{document}

2 Answers 2

4

Sometimes, less is more. (I added the nodes just to see what was going on.)

\documentclass{amsart}
\usepackage{amsmath}
\usepackage{amsfonts}

\usepackage{tikz}
\usetikzlibrary{calc,angles,positioning,intersections}


\begin{document}



\noindent \hspace*{\fill}
\begin{tikzpicture}

\path (0,0) coordinate (A_1)
(60:1.75) coordinate (A_2)
($(A_2)!0.5cm!90:(A_1)$) coordinate (A_3)
($(A_3)!1cm!120:(A_2)$) coordinate (A_4)
($(A_4)!0.75cm!120:(A_3)$) coordinate (A_5);

\draw (A_1) -- (A_2) -- (A_3) -- (A_4) -- (A_5) -- cycle;

\draw[fill] (A_1) circle (1.5pt) node[above] {A1};
\draw[fill] (A_2) circle (1.5pt) node[above] {A2};
\draw[fill] (A_3) circle (1.5pt) node[above] {A3};
\draw[fill] (A_4) circle (1.5pt) node[above] {A4};
\draw[fill] (A_5) circle (1.5pt) node[above] {A5};

\end{tikzpicture}
\end{document}

pentagon

5
  • I see that you removed the (A_i) + from the commands for coordinates of A_3, A_4, and A_5. Why is my code wrong for locating these three points? I thought that \coordinate (A_3) at ($(A_2) +($(A_2)!0.5cm!90:(A_1)$)$) places A_3 at 0.5cm from A_2 that is perpendicular to line segment $\overline{A_1A_2}$.
    – user74973
    Commented Nov 3, 2015 at 14:13
  • 1
    ($(A)!1cm!90:(B)$) translates as "Start at (A) and travel 1cm in the direction 90 from (B)". Commented Nov 3, 2015 at 14:17
  • Start at A and travel 1cm in the direction 90 degrees from line segment AB.
    – user74973
    Commented Nov 4, 2015 at 14:57
  • 1
    @user74973 - If we are using strict geometry nomenclature, make that 90 degrees counter-clockwise from $\overrightarrow{AB}$ ;-) Commented Nov 4, 2015 at 15:26
  • That will save me some time ... if I can remember it. Thanks!
    – user74973
    Commented Nov 4, 2015 at 16:04
1

Here is a short code from pst-node

\documentclass[x11names, border=3pt]{standalone}
\usepackage{pstricks-add}
\usepackage{auto-pst-pdf}
\pagestyle{empty}

\begin{document}

\begin{pspicture}
    \psset{dimen=middle, unit=2, labelsep=0.8ex, linecolor=IndianRed3, linewidth=1.2pt}
    \pnode(0,0){A}
    \AplusB(A)(1.75;60){B}\AplusB(B)(.5;-30){C}\AplusB(C)(1;-90){D}\AplusB(D)(.75;-150){E}
    \pspolygon(A)(B)(C)(D)(E)
    \uput[l](A){$A$}\uput[u](B){$B$}\uput[ur](C){$C$}\uput[r](D){$D$}\uput[d](E){$E$}
\end{pspicture}

\end{document} 

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .