如何在特定点开始曲线贝塞尔曲线?

如何在特定点开始曲线贝塞尔曲线?

我目前正在摆弄 pgf 库curvilinear。我想要做的是制作一个像 的形状一样弯曲的形状gridgrid与这个非常相似:画布网格转换为曲线网格

然而,有一个问题是,我似乎无法grid在我的 中的指定位置生成它tikzpicture。我怎样才能grid在我的 中的点 (0,-5)处生成tikzpicture

所以基本上,我想在非线性变换上创建一个平坦的偏移量,然后使用它作为参考来制作一个覆盖网格的矩形曲线(但这不应该是太大的问题)。

代码:

\documentclass[landscape,svgnames]{article}
\usepackage[a3paper]{geometry}
\usepackage{tikz}
\usetikzlibrary{fadings,shapes.arrows,shadows,arrows,positioning,shapes}
\usepgflibrary{curvilinear}
\usepgfmodule{nonlineartransformations}

\makeatletter  
\pgfkeys{%
/polargrid/.cd,
rmin/.code ={\global\def\rmin {#1}},
rmax/.code ={\global\def\rmax {#1}},
amin/.code ={\global\def\amin {#1}},
amax/.code ={\global\def\amax {#1}},
rstep/.code={\global\def\rstep{#1}}, 
astep/.code={\global\def\astep{#1}}}

\def\polargrid{\pgfutil@ifnextchar[{\polar@grid}{\polar@grid[]}}%
\def\polar@grid[#1]{%
\pgfkeys{/polargrid/.cd,
rmin ={0},
rmax ={10},
amin ={0},
amax ={180},
rstep={1}, 
astep={10}}   
%
\pgfqkeys{/polargrid}{#1}%
\pgfmathsetmacro{\addastep}{\amin+\astep} 
\pgfmathsetmacro{\addrstep}{\rmin+\rstep} 
 \foreach \a in {\amin,\addastep,...,\amax}  \draw[gray] (\a:\rmin) -- (\a:\rmax);  
 \foreach \r in {\rmin,\addrstep,...,\rmax}  \draw[gray] (\amin:\r cm) arc (\amin:\amax:\r cm);    
 } 
\makeatother  

\begin{document}
\begin{tikzpicture}[scale=2,node distance=1cm, auto,baseline=-.5ex]

\polargrid[rmin=4,rmax=8,amin=180,amax=360] at (5,0)

\end{tikzpicture}
\end{document}

答案1

谢谢你,https://tex.stackexchange.com/users/3235/percusse

为了简单参考,您可以找到以下环境创建的偏移量的代码scope

\documentclass[landscape,svgnames]{article}
\usepackage[a3paper]{geometry}
\usepackage{tikz}
\usetikzlibrary{fadings,shapes.arrows,shadows,arrows,positioning,shapes}
\usepgflibrary{curvilinear}
\usepgfmodule{nonlineartransformations}

\makeatletter  
\pgfkeys{%
/polargrid/.cd,
rmin/.code ={\global\def\rmin {#1}},
rmax/.code ={\global\def\rmax {#1}},
amin/.code ={\global\def\amin {#1}},
amax/.code ={\global\def\amax {#1}},
rstep/.code={\global\def\rstep{#1}}, 
astep/.code={\global\def\astep{#1}}}

\def\polargrid{\pgfutil@ifnextchar[{\polar@grid}{\polar@grid[]}}%
\def\polar@grid[#1]{%
\pgfkeys{/polargrid/.cd,
rmin ={0},
rmax ={10},
amin ={0},
amax ={180},
rstep={1}, 
astep={10}}   
%
\pgfqkeys{/polargrid}{#1}%
\pgfmathsetmacro{\addastep}{\amin+\astep} 
\pgfmathsetmacro{\addrstep}{\rmin+\rstep} 
 \foreach \a in {\amin,\addastep,...,\amax}  \draw[gray] (\a:\rmin) -- (\a:\rmax);  
 \foreach \r in {\rmin,\addrstep,...,\rmax}  \draw[gray] (\amin:\r cm) arc (\amin:\amax:\r cm);    
 } 
\makeatother  

\begin{document}
\begin{tikzpicture}[scale=2,node distance=1cm, auto,baseline=-.5ex]

\node (dummy) at (0,-5) {}; % create dummy node

\begin{scope}[remember picture,overlay,shift={(dummy.center)}] %create a shift using the scope environment
\polargrid[rmin=0,rmax=8,amin=180,amax=360]
\end{scope}

\end{tikzpicture}
\end{document}   

相关内容