TransWikia.com

How to simply rotate without any shifts

TeX - LaTeX Asked on August 15, 2021

So I am trying to draw a simple vector at the (-2,-2) point that is exactly 60 degrees. However, when I rotate, it places the arrow somewhere completely different. I do not know what else to do because putting in xshift or yshift options are too much guesswork involved. What do I do?

documentclass[tikz,border=3mm]{standalone}
usepackage{tikz}
usetikzlibrary{arrows.meta,calc,positioning,decorations.pathreplacing,calligraphy}
usepackage{tikzsymbols}

begin{document}
begin{tikzpicture}
filldraw (-2,-2) circle (1.5pt);
draw[thick] (-2,-2) ..controls +(60:1) and +(160:1) ..(0,-1)
            ..controls +(340:1) and +(250:1) ..(2.5,0);
draw (-2.25,-2.25) rectangle (-1.75,-1.75);
draw[-stealth,rotate=60,thick] (-2,-2)--(-1.5,-2);
end{tikzpicture}

end{document}

2 Answers

By default, rotations are done around the origin point (0,0), to rotate around another point, it must be explicitly specified.

I quote the manual:

/tikz/rotate around={<degree>:<coordinate>} (no default)

Rotates the coordinate system by <degree> around the point <coordinate>.

draw[-stealth,rotate around ={60:(-2,-2)},thick,blue] (-2,-2)node{x}--(-1.5,-2);

screenshot

documentclass[tikz,border=3mm]{standalone}
usepackage{tikz}
usetikzlibrary{arrows.meta,calc,positioning,decorations.pathreplacing,calligraphy}
usepackage{tikzsymbols}

begin{document}
begin{tikzpicture}
filldraw (-2,-2) circle (1.5pt);
draw[thick] (-2,-2) ..controls +(60:1) and +(160:1) ..(0,-1)
            ..controls +(340:1) and +(250:1) ..(2.5,0);
draw (-2.25,-2.25) rectangle (-1.75,-1.75);
draw[-stealth,rotate around ={60:(-2,-2)},thick,blue] (-2,-2)node{x}--(-1.5,-2);
end{tikzpicture}

end{document}

Correct answer by AndréC on August 15, 2021

To long to be a comment ...

Do you looking for something like this:

enter image description here

Arrows is drawn by using polar coordinate:

documentclass[tikz,border=3mm]{standalone}

begin{document}
    begin{tikzpicture}
filldraw (-2,-2) circle (1.5pt);
draw[thick] (-2,-2) ..controls +(60:1) and +(160:1) ..(0,-1)
            ..controls +(340:1) and +(250:1) ..(2.5,0);
draw (-2.25,-2.25) rectangle (-1.75,-1.75);
draw[-stealth] (-2,-2) -- ++ (60:1);
    end{tikzpicture}
end{document}

Answered by Zarko on August 15, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP