答案1
这是实现此类目标的一种方法。
\documentclass[tikz,border=3mm]{standalone}
\usepgfmodule{nonlineartransformations}
\usetikzlibrary{fpu}
\newcommand{\PgfmathsetmacroFPU}[2]{\begingroup%
\pgfkeys{/pgf/fpu,/pgf/fpu/output format=fixed}%
\pgfmathsetmacro{#1}{#2}%
\pgfmathsmuggle#1\endgroup}
\tikzset{declare function={xtransformed(\x,\y)=\pgfkeysvalueof{/tikz/trafos/a}*
sign(\x)*\y*\y;},
trafos/.cd,a/.initial=pi}
\makeatletter
\def\mytransformation{%
\PgfmathsetmacroFPU{\myy}{\pgf@y}%
\PgfmathsetmacroFPU{\myx}{\pgf@x+xtransformed(\pgf@x/1cm,\pgf@y/1cm)}%\typeout{(\the\pgf@x,\the\pgf@y)|->(\myx pt,\myy pt)}
\pgf@x=\myx pt%
\pgf@y=\myy pt%
}
\makeatother
\begin{document}
\begin{tikzpicture}
\draw (-2,-2) rectangle (2,2);
\draw (0,0) circle [radius=pi/2];
\end{tikzpicture}
\begin{tikzpicture}
\begin{scope}
\pgftransformnonlinear{\mytransformation}
\draw (-2,-2) rectangle (2,2);
\draw (0,0) circle [radius=pi/2];
\end{scope}
\end{tikzpicture}
\end{document}
还有curvilinear
图书馆,但我认为如果你想使用它,你需要将图片分成两半。