3
1

Je dessine des schémas à l'aide TikZ, en surimpression sur des photos, au sein d'un environnement scope.

J'utilise la fonction rotate around pour aligner mes rectangles avec des éléments présents sur la photo.

J'ai positionné sans aucun souci un cercle sous un rectangle que je venais de tracer.

Mais voilà : si je transforme ce cercle en nœud, en lui conservant exactement les mêmes coordonnées et la même rotation, il se trouve alors positionné ailleurs. Je ne m'explique pas ce phénomène.

Ouvrir dans l'éditeur Overleaf
\documentclass[12pt, a4paper, landscape, english, BCOR = 0pt, DIV = 15]{scrartcl}
\usepackage[utf8x]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{mwe}
\usepackage{tikz}
\usepackage{babel}
\begin{document}
\pagestyle{empty}
\noindent
\begin{center}
\begin{tikzpicture}
\node[anchor=south west,inner sep=0] (image) at (0,0) {
\includegraphics[keepaspectratio=true, width=.8\textwidth]{example-image-a}} ;
\begin{scope}[x={(image.south east)}, y={(image.north west)}, node distance = 4 pt]
%% \draw[step=.1, gray, very thin] (0, 0) grid (1, 1);
%% \draw[step=.01, gray, very thin, opacity = .5] (0, 0) grid (1, 1);
%%%% Le rectangle
\filldraw [color = red, opacity = 0.5,
rotate around={-6.5:(0.4325, 0.44)}
]
(0.425, 0.39) rectangle (0.44, 0.49) ;
%%%% Le cercle sous ledit rectangle
\filldraw [teal,
rotate around={-6.5:(0.4325, 0.44)}
]
(0.4325, 0.38) circle [radius = 2 pt] ;
%%%% Le cercle transformé en nœud... et exilé n'importe où !
\node [circle, inner sep = 2 pt, minimum size = 2 pt,
color = teal, fill = teal,
rotate around = {-6.5:(0.4325, 0.44)}
]
(pa3) at (0.4325, 0.38) {} ;
\end{scope}
\end{tikzpicture}
\end{center}
\end{document}
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Comment se fait-il que les deux points verts ci-dessous, bien distincts, soient issus du même jeu de coordonnées ?

Posée 22 Sep '18, 14:08

Pathe's gravatar image

Pathe ♦♦
7.6k49210252
Taux d'acceptation : 55%

Modifiée 22 Sep '18, 19:17


Je ne peux pas trouver une explication complète dans la documentation, (très large et en anglais), de pgf. Toutefois, la lecture de la section 17.7, page 234, peut-être intéressante.

Ici les coordonnées (0.4325, 0.44) de centre de rotation sont relatif au nœud (pa3), (l'origine du repère est le centre de node i.e. c'est (pa3.center)).

Pour éviter ce problème, on commence par définir le centre de rotation avec \coordinate (C) at (0.4325, 0.44); puis rotate around={-6.5:(C)}.

ECM

Ouvrir dans l'éditeur Overleaf
\documentclass[12pt, a4paper, landscape, english, BCOR = 0pt, DIV = 15]{scrartcl}
\usepackage{lmodern}
\usepackage[T1]{fontenc}
\usepackage{tikz}
\usepackage{babel}
\begin{document}
\pagestyle{empty}
\begin{center}
\begin{tikzpicture}
\node[anchor=south west,inner sep=0] (image) at (0,0) {%
\includegraphics[keepaspectratio=true, width=.8\textwidth]{example-image-a}};
\begin{scope}[x={(image.south east)}, y={(image.north west)}, node distance = 4 pt]
\coordinate (C) at (0.4325, 0.44);
\filldraw [color = red, opacity = 0.5,
rotate around={-6.5:(C)}
]
(0.425, 0.39) rectangle (0.44, 0.49);
\filldraw [teal,
rotate around={-6.5:(C)}
]
(0.4325, 0.38) circle [radius = 2 pt];
\node [circle, inner sep = 2 pt, minimum size = 2 pt,
color = teal, fill = teal,
rotate around={-6.5:(C)}
]
(pa3) at (0.4325, 0.38) {} ;
\end{scope}
\end{tikzpicture}
\end{center}
\end{document}
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Lien permanent

Publiée 23 Sep '18, 22:10

touhami's gravatar image

touhami
9.9k410
Taux d'acceptation : 51%

Votre réponse
[Masquer l'aperçu]

Suivre cette question

Par courriel :

Une fois que vous serez enregistré, vous pourrez souscrire à n'importe quelle mise à jour ici

Par flux RSS :

Réponses

Réponses et commentaires

Mots-clés de la question :

×109
×3
×2

Question posée : 22 Sep '18, 14:08

Question vue : 4,571 fois

Dernière mise à jour : 23 Sep '18, 22:10

C'est votre première visite ici ? Consultez la FAQ !

×