如何根据函数定义可变步长网格?

如何根据函数定义可变步长网格?

我想要对一个方形区域进行网格划分,并且线之间的距离不相等。

线之间的距离是 COS(X) 或 SIN(Y) 或 X(1-X) 的函数。

可以设计提及图片吗?

在此处输入图片描述

\documentclass[tightpage]{standalone}‎
‎\usepackage{varwidth}‎
\usepackage{tikz}
\usetikzlibrary{positioning}
\begin{document}
\pagestyle{empty}


\begin{tikzpicture}[scale=.9,every node/.style={minimum size=1cm},on grid]

    %slanting: production of a set of n 'laminae' to be piled up. N=number of grids.
    \begin{scope}[
            yshift=-83,every node/.append style={
            yslant=0.5,xslant=-1},yslant=0.5,xslant=-1
            ]
        % opacity to prevent graphical interference
        \fill[white,fill opacity=0.9] (0,0) rectangle (5,5);
        \draw[step=4mm, black] (0,0) grid (5,5); %defining grids
        \draw[black,very thick] (0,0) rectangle (5,5);%marking borders
        %Idem as above, for the n-th grid:
    \end{scope}
\end{tikzpicture}

\end{document}

答案1

像这样吗?

在此处输入图片描述

\documentclass[tikz,border=2mm]{standalone} 
\begin{document}
\begin{tikzpicture}

\coordinate (origin) at (0,0);

\foreach \i [evaluate=\i as \xi using \i*(10-\i)/10] in {1,2,...,10}{
    \draw ([xshift=\xi cm]origin)--++(90:2.5cm);
    \draw ([yshift=\xi cm]origin)--++(0:2.5cm);
    }
\end{tikzpicture}
\end{document}

答案2

    \documentclass[tikz,tikz-3dplot, border=2mm]{standalone} 
\begin{document}
\begin{tikzpicture}[scale=3]
   \begin{scope}[
            yshift=-83,every node/.append style={
            yslant=0.5,xslant=-1},yslant=0.5,xslant=-1 ]
\coordinate (origin) at (0,0);
\foreach \i [evaluate=\i as \xi using 0.5*(1-cos((\i-1)*180/(10-1)))] in {1,2,...,10}{
    \draw ([xshift=\xi cm]origin)--++(90:1cm);
    \draw ([yshift=\xi cm]origin)--++(0:1cm);
    }‎‎

\end{tikzpicture}
\end{document}

在此处输入图片描述

相关内容