更新

更新

更新

如何让阴影在变换后的图形的 theta 方向上变化,而不是从左到右?我希望原始矩形中从左到右的阴影会变成增加 theta 方向的阴影! 在此处输入图片描述

\documentclass{standalone}
\usepackage{tikz}
\usepgfmodule{nonlineartransformations}
\usepgfmodule[nonlineartransformations]

\makeatletter
\def\polartransformation
{
    % \pgf@x will contain the radius
    % \pgf@y will contain the distance
    \pgfmathsincos@{\pgf@sys@tonumber\pgf@x}%
    % pgfmathresultx is now the cosine of radius and
    % pgfmathresulty is the sine of radius
    \pgf@x=\pgfmathresultx\pgf@y%
    \pgf@y=\pgfmathresulty\pgf@y%
}
\makeatother

\begin{document}
    \begin{tikzpicture}

    \draw [black, left color=white, right color=gray ] (3,1) rectangle (7.5,2);
    {
        \pgftransformnonlinear{\polartransformation}
        \pgfsettransformnonlinearflatness{2pt}
        \draw [black, left color=white, right color=gray ] (3,1) rectangle (7.5,2);
    }
    \end{tikzpicture}
\end{document}

原始问题:

我只是想使用极坐标变换将此阴影区域转换为环形区域。生成的阴影区域应为简单图表中所示的环形切片(抱歉质量不佳)。我希望阴影保持其“方向”。矩形是在下面的 tikz 代码中创建的,其中大部分代码取自 PGF 手册。

在此处输入图片描述

\documentclass{standalone}
\usepackage{tikz}
\usepgfmodule{nonlineartransformations}
\usepgfmodule[nonlineartransformations]

\def\polartransformation
{
    % \pgf@x will contain the radius
    % \pgf@y will contain the distance
    \pgfmathsincos@{\pgf@sys@tonumber\pgf@x}%
    % pgfmathresultx is now the cosine of radius and
    % pgfmathresulty is the sine of radius
    \pgf@x=\pgfmathresultx\pgf@y%
    \pgf@y=\pgfmathresulty\pgf@y%
}


\begin{document}
    \begin{tikzpicture}

    \draw[black] (0:20mm) arc [start angle=0,end angle = 90, radius=2cm];
    {
        \pgftransformnonlinear{\polartransformation}
        \pgfsettransformnonlinearflatness{2pt}
        \draw [black, left color=white, right color=gray ] (3,3) rectangle (4,3.5);
    }
    \end{tikzpicture}
\end{document}

但在这里我得到了错误:

Missing number, treated as zero. ...left color=white, right color=gray ] (3,3)

相关内容