2

I am trying to rotate point (B0) by 90 degrees ccw around (A1) and then loop it to get (B\k) and (A\k). What am I doing wrong?

\documentclass[tikz]{standalone}
\begin{document}
\begin{tikzpicture}[scale=5]
\coordinate (A0) at (0,0);
\coordinate (B0) at (0,1);
\path[draw,blue](A0)--(B0)coordinate[pos=.382](A1);
\coordinate(B1)at([rotate around={90:(A1)}]B0);
\draw[red](A1)--(B1);
\end{tikzpicture}
\end{document}

Red is what I get, green is what I excpect

red is what I get using

([rotate around={90:(A1)}]B0)

and green is what I would like to see.

  • hint--> play around with scale value – percusse Jul 22 '15 at 13:19
1

Like this?

\documentclass[12pt]{article}
\pagestyle{empty}
\usepackage{tikz}
\begin{document}
\center
\begin{tikzpicture}[scale=5]
\coordinate (A0) at (0,0);
\node (A) at (A0) {A};
\coordinate (B) at (0,1);
    \foreach \k in {0,90,180,270}
    {
        \node (B\k) at ([rotate around={\k:(A0)}]B) {B\k};;
    }
\end{tikzpicture}
\end{document}

Pic

  • Not exactly. The centres for rotations in a loop will be succesive A\j. But his is not the issue yet. The problem is that B1 is not where I want it to be. – Rafał Jul 22 '15 at 12:04
  • Shall it look like using \draw[red](A1)--([rotate around={90:(A1)}]B0); ? – Konne Jul 22 '15 at 12:10
  • Still what I get by ([rotate around={90:(A1)}]B0) is sth like (1,2), but I want (-.618,.382) – Rafał Jul 22 '15 at 12:25
  • @Konne In your example, change (0,0) by (1,0) to see the problem of your answer... – Paul Gaborit Jul 22 '15 at 15:50
0

Ok, I got it. That question helped a lot:

Why such rotate in tikz doesn't work?

Now my code enriched with loop is like this and works perfectly:

\documentclass[tikz]{standalone}
 \usetikzlibrary{shapes.arrows,chains,positioning,intersections,decorations.text}
\usetikzlibrary{calc}
\usepackage{ifthen}
\begin{document}
%
\center
\begin{tikzpicture}[scale=15]
\coordinate (A0) at (0,0);
\coordinate (B0) at (0,1);
\draw[blue](A0)--(B0);
\foreach \k[evaluate={\ki=int(\k-1)}] in {1,...,7}
{\path(A\ki)--(B\ki)coordinate[pos=.382](A\k);
\draw[red] let \p\ki=(A\ki), \p\k=(A\k) in (\p\k)--([rotate around={90:(\p\k)}]B\ki)coordinate(B\k);
\node[draw] at (B\k){B\k};}
\end{tikzpicture}
\end{document}
0

It seems that the source of your problem is scaling. It scales coordinates of center of rotation twice. Once when you define (A1), second for rotation (you can see this by explicit notation {90:(0,1.91)})

\begin{tikzpicture}
\tikzstyle{subj} = [circle, minimum width=0.2mm, draw,inner sep=1mm]
\coordinate (A0) at (0,0);
\coordinate (B0) at (0,5);
\path[draw,blue](A0)--(B0) coordinate[pos=.382](A1);
\coordinate(B1)at ([rotate around={90:(A1)}]B0);
\draw[red](A1)--(B1);
\node[subj] at (A0) {A0};
\node[subj] at (B1) {B1};
\node[subj] at (B0) {B0};
\node[subj] at (A1) {A1};
\end{tikzpicture}

  • Yes, you're right. B1 moves while I change scale. But I want the picture scaled. Hence there seem to be 2 solutions: change scale by adjusting A0 or do this \p trick to enable perform normal scaling. Thanks. – Rafał Jul 22 '15 at 17:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.