¿Por qué escalar una imagen tikz hace que desaparezca todo lo que está dentro del alcance del lienzo de transformación?

¿Por qué escalar una imagen tikz hace que desaparezca todo lo que está dentro del alcance del lienzo de transformación?

Dibujé una imagen tikz, pero después de escalar la imagen usando \begin{tikzpicture}[scale=200/(\hsize-24)], todo lo que esté dentro del alcance del lienzo de transformación desaparece. ¿Alguien podría explicar esto?

Esta es la imagen original de tikz.

\documentclass[tikz, border=12]{standalone}

\usepackage{tikz, tkz-euclide, pgfmath, pstricks}
\usetikzlibrary{intersections, decorations.markings, angles,
quotes, calc, arrows, arrows.meta}
\usetkzobj{all}
%
\definecolor{blue}{RGB}{0,51,255}
\definecolor{green}{RGB}{0,153,0}
\definecolor{blue1}{RGB}{174,214,241}
\definecolor{blue}{RGB}{161,207,223}
\definecolor{yellow}{RGB}{255,220,0}
\colorlet{dcolor}{blue}
%
\begin{document}
\begin{tikzpicture}
\pgfgettransformentries{\mya}{\myb}{\myc}{\myd}{\mys}{\myt}
\pgfmathsetmacro{\preserve}{1/\mya}
\begin{scope}[>={Stealth[scale=1.2]} , thick,rotate=0 ] 

%
\newcommand\height{10}
%
\newcommand\Ac{-4}
%
\newcommand\Bc{27.46586300953384}
%
\pgfmathsetmacro{\distance}{\Bc+\Ac}
\draw (0,-0.2) node [color=black,fill=white,below] {$Q$};
\draw [fill=black] (\Ac-0.1*\distance,0)--(\Bc+0.1*\distance,0)--(\Bc+0.1*\distance,0.01*\height)--(\Ac-0.1*\distance,0.01*\height)--cycle;
\draw [fill=black] (\Ac-0.1*\distance,\height)--(\Bc+0.1*\distance,\height)--(\Bc+0.1*\distance,1.01*\height)--(\Ac-0.1*\distance,1.01*\height)--cycle;
\draw [black,densely dashed](0,0)--(0,\height);


%
\coordinate (pulleyCenter) at (0,0.9*\height);
%
\pgfmathsetmacro{\pulleyRadius}{0.0375*\height}

\draw (0,0.9*\height-\pulleyRadius) node [color=black,fill=white,below] {$P$};

\draw [line width = 0.2*\distance,line cap=round](0,0.9*\height)--(0,0.995*\height);
\draw [line width = 0.2*\distance]([shift={(0,\height)}]0:-0.025*\height) arc[radius=0.025*\height, start angle=180, end angle= 360];

\pgfmathsetmacro{\ax}{\Bc-0.04*\distance}
\pgfmathsetmacro{\bx}{\Bc+0.04*\distance}
\pgfmathsetmacro{\lowerwidth}{\bx-\ax}
\pgfmathsetmacro{\aby}{0.2+0.01*\height}
\pgfmathsetmacro{\dx}{\Bc-0.08*\distance}
\pgfmathsetmacro{\cx}{\Bc+0.08*\distance}
\pgfmathsetmacro{\upperwidth}{\cx-\dx}
\pgfmathsetmacro{\cartheight}{1.25*\lowerwidth}
\pgfmathsetmacro{\dcy}{\aby+\cartheight}
\coordinate(a) at (\ax,\aby);
\coordinate(b) at (\bx,\aby);
\coordinate(d) at (\dx,\dcy);
\coordinate(c) at (\cx,\dcy);


\pgfmathsetmacro{\adx}{\Bc-0.06*\distance}
\pgfmathsetmacro{\ady}{\aby+0.5*\cartheight}
\coordinate (c1) at (\adx,\ady);
\draw [gray!120,line width = 0.01*\height cm,line cap=round](c1)--++(180:0.01*\Bc) coordinate (e1);


\coordinate (c2) at (\Bc+0.06*\distance,\ady);
\draw [gray!120,line width = 0.01*\height cm,line cap=round](c2)--++(0:0.01*\Bc) coordinate (e2);


\draw [line width = 0.005*\height cm,blue!200,fill=blue](a)--(b)--(c)--(d)--cycle;

\tkzTangent[from with R=e1](pulleyCenter,\pulleyRadius cm) \tkzGetPoints{D1}{D2}

\draw[yellow, line width = 0.010*\height cm,line cap =round](e1)--(D1);
\draw [gray!120,line width = 0.01*\height cm,line cap=round](c1)--(e1);
\draw [line width = 0.005*\height cm,blue!200,fill=blue](a)--(b)--(c)--(d)--cycle;

\pgfmathsetmacro{\wheelax}{0.25*\lowerwidth+\ax}
\pgfmathsetmacro{\wheelbx}{0.75*\lowerwidth+\ax}
\draw[black,fill=black](\wheelax,\aby)circle(\aby-0.011*\height);
\draw[black,fill=gray](\wheelax,\aby)circle(0.75*\aby-0.75*0.011*\height);

\draw[black,fill=black](\wheelbx,\aby)circle(\aby-0.011*\height);
\draw[black,fill=gray](\wheelbx,\aby)circle(0.75*\aby-0.75*0.011*\height);

\draw (\Bc,\ady) node [color=black] {$A$};


\pgfmathsetmacro{\shift}{\Ac-\Bc}
\begin{scope}[transform canvas={xshift=\shift cm}]
\draw [gray!120,line width = 0.01*\height cm,line cap=round](c1)--(e1);
\draw [gray!120,line width = 0.01*\height cm,line cap=round](c2)--(e2);
\coordinate (pulleyCenter) at (-1*\shift,0.9*\height);
\tkzTangent[from with R=e2](pulleyCenter,\pulleyRadius cm) \tkzGetPoints{D1}{D2}
\draw[yellow, line width = 0.01*\height cm,line cap =round](e2)--(D2);
\draw[gray!120,line width = 0.01*\height cm,line cap=round](c2)--(e2);
\draw [line width = 0.005*\height cm,blue!200,fill=blue](a)--(b)--(c)--(d)--cycle;
\draw[black,fill=black](\wheelax,\aby)circle(\aby-0.011*\height);
\draw[black,fill=gray](\wheelax,\aby)circle(0.75*\aby-0.75*0.011*\height);

\draw[black,fill=black](\wheelbx,\aby)circle(\aby-0.011*\height);
\draw[black,fill=gray](\wheelbx,\aby)circle(0.75*\aby-0.75*0.011*\height);
\draw (\Bc,\ady) node [color=black] {$B$};

\draw [gray,fill=gray!50,line width = 0.005*\height cm](pulleyCenter) circle(\pulleyRadius);
\end{scope}



\end{scope}
\end{tikzpicture}
\end{document}

ingrese la descripción de la imagen aquí

Y esta es la misma imagen de tikz después de usarla.\begin{tikzpicture}[scale=200/(\hsize-24)]

\documentclass[tikz, border=12]{standalone}

\usepackage{tikz, tkz-euclide, pgfmath, pstricks}
\usetikzlibrary{intersections, decorations.markings, angles,
quotes, calc, arrows, arrows.meta}
\usetkzobj{all}
%
\definecolor{blue}{RGB}{0,51,255}
\definecolor{green}{RGB}{0,153,0}
\definecolor{blue1}{RGB}{174,214,241}
\definecolor{blue}{RGB}{161,207,223}
\definecolor{yellow}{RGB}{255,220,0}
\colorlet{dcolor}{blue}
%
\begin{document}
\begin{tikzpicture}[scale=200/(\hsize-24)]

\pgfgettransformentries{\mya}{\myb}{\myc}{\myd}{\mys}{\myt}
\pgfmathsetmacro{\preserve}{1/\mya}
\begin{scope}[>={Stealth[scale=1.2]} , thick,rotate=0 ] 

%
\newcommand\height{10}
%
\newcommand\Ac{-4}
%
\newcommand\Bc{27.46586300953384}
%
\pgfmathsetmacro{\distance}{\Bc+\Ac}
\draw (0,-0.2) node [color=black,fill=white,below] {$Q$};
\draw [fill=black] (\Ac-0.1*\distance,0)--(\Bc+0.1*\distance,0)--(\Bc+0.1*\distance,0.01*\height)--(\Ac-0.1*\distance,0.01*\height)--cycle;
\draw [fill=black] (\Ac-0.1*\distance,\height)--(\Bc+0.1*\distance,\height)--(\Bc+0.1*\distance,1.01*\height)--(\Ac-0.1*\distance,1.01*\height)--cycle;
\draw [black,densely dashed](0,0)--(0,\height);


%
\coordinate (pulleyCenter) at (0,0.9*\height);
%
\pgfmathsetmacro{\pulleyRadius}{0.0375*\height}

\draw (0,0.9*\height-\pulleyRadius) node [color=black,fill=white,below] {$P$};

\draw [line width = 0.2*\distance,line cap=round](0,0.9*\height)--(0,0.995*\height);
\draw [line width = 0.2*\distance]([shift={(0,\height)}]0:-0.025*\height) arc[radius=0.025*\height, start angle=180, end angle= 360];

\pgfmathsetmacro{\ax}{\Bc-0.04*\distance}
\pgfmathsetmacro{\bx}{\Bc+0.04*\distance}
\pgfmathsetmacro{\lowerwidth}{\bx-\ax}
\pgfmathsetmacro{\aby}{0.2+0.01*\height}
\pgfmathsetmacro{\dx}{\Bc-0.08*\distance}
\pgfmathsetmacro{\cx}{\Bc+0.08*\distance}
\pgfmathsetmacro{\upperwidth}{\cx-\dx}
\pgfmathsetmacro{\cartheight}{1.25*\lowerwidth}
\pgfmathsetmacro{\dcy}{\aby+\cartheight}
\coordinate(a) at (\ax,\aby);
\coordinate(b) at (\bx,\aby);
\coordinate(d) at (\dx,\dcy);
\coordinate(c) at (\cx,\dcy);


\pgfmathsetmacro{\adx}{\Bc-0.06*\distance}
\pgfmathsetmacro{\ady}{\aby+0.5*\cartheight}
\coordinate (c1) at (\adx,\ady);
\draw [gray!120,line width = 0.01*\height cm,line cap=round](c1)--++(180:0.01*\Bc) coordinate (e1);


\coordinate (c2) at (\Bc+0.06*\distance,\ady);
\draw [gray!120,line width = 0.01*\height cm,line cap=round](c2)--++(0:0.01*\Bc) coordinate (e2);


\draw [line width = 0.005*\height cm,blue!200,fill=blue](a)--(b)--(c)--(d)--cycle;

\tkzTangent[from with R=e1](pulleyCenter,\pulleyRadius cm) \tkzGetPoints{D1}{D2}

\draw[yellow, line width = 0.010*\height cm,line cap =round](e1)--(D1);
\draw [gray!120,line width = 0.01*\height cm,line cap=round](c1)--(e1);
\draw [line width = 0.005*\height cm,blue!200,fill=blue](a)--(b)--(c)--(d)--cycle;

\pgfmathsetmacro{\wheelax}{0.25*\lowerwidth+\ax}
\pgfmathsetmacro{\wheelbx}{0.75*\lowerwidth+\ax}
\draw[black,fill=black](\wheelax,\aby)circle(\aby-0.011*\height);
\draw[black,fill=gray](\wheelax,\aby)circle(0.75*\aby-0.75*0.011*\height);

\draw[black,fill=black](\wheelbx,\aby)circle(\aby-0.011*\height);
\draw[black,fill=gray](\wheelbx,\aby)circle(0.75*\aby-0.75*0.011*\height);

\draw (\Bc,\ady) node [color=black] {$A$};


\pgfmathsetmacro{\shift}{\Ac-\Bc}
\begin{scope}[transform canvas={xshift=\shift cm}]
\draw [gray!120,line width = 0.01*\height cm,line cap=round](c1)--(e1);
\draw [gray!120,line width = 0.01*\height cm,line cap=round](c2)--(e2);
\coordinate (pulleyCenter) at (-1*\shift,0.9*\height);
\tkzTangent[from with R=e2](pulleyCenter,\pulleyRadius cm) \tkzGetPoints{D1}{D2}
\draw[yellow, line width = 0.01*\height cm,line cap =round](e2)--(D2);
\draw[gray!120,line width = 0.01*\height cm,line cap=round](c2)--(e2);
\draw [line width = 0.005*\height cm,blue!200,fill=blue](a)--(b)--(c)--(d)--cycle;
\draw[black,fill=black](\wheelax,\aby)circle(\aby-0.011*\height);
\draw[black,fill=gray](\wheelax,\aby)circle(0.75*\aby-0.75*0.011*\height);

\draw[black,fill=black](\wheelbx,\aby)circle(\aby-0.011*\height);
\draw[black,fill=gray](\wheelbx,\aby)circle(0.75*\aby-0.75*0.011*\height);
\draw (\Bc,\ady) node [color=black] {$B$};

\draw [gray,fill=gray!50,line width = 0.005*\height cm](pulleyCenter) circle(\pulleyRadius);
\end{scope}



\end{scope}
\end{tikzpicture}
\end{document}

ingrese la descripción de la imagen aquí

Respuesta1

La escala de la imagen tikz no se aplica al cambio x dentro del lienzo de transformación, por lo que todo lo que tuve que hacer fue aplicar la escala al cambio fuera del lienzo de transformación y luego usar el valor escalado dentro de la transformación del lienzo. así que usé esto

\pgfmathsetmacro{\shift}{\Ac-\Bc}
\pgfmathsetmacro{\shifta}{200/(\hsize-24)*\shift}
\begin{scope}[transform canvas={xshift=\shifta cm}]

en lugar de esto

\pgfmathsetmacro{\shift}{\Ac-\Bc}
\begin{scope}[transform canvas={xshift=\shift cm}]

y el resto del código es el mismo.

información relacionada