如何获得曲线的精确弯曲

如何获得曲线的精确弯曲

我想要得到下图:

在此处输入图片描述

我所做的工作如下:

\documentclass[tikz, margin=3mm]{standalone}
\usetikzlibrary{decorations.markings}
    \begin{document}
         \begin{tikzpicture}[%x=2cm,y=2cm
        dot/.style = {circle, fill,
                      inner sep=.3ex,
                      }
                            ]
    \draw[-latex, thick, draw=black] (-1,0)--(4,0) node [right] {$x$};
    \draw[-latex, thick, draw=black] (0,-4)--(0,4) node [above] {$y$};
    \draw[scale=1,red,fill=red] (0, 0) circle (.3ex);
        \draw[scale=1] (0, 0) node[anchor=north east]{$O$} ;
        \draw[scale=1,red,fill=red] (3,3.25) circle (.3ex);
        \draw[scale=1,red,fill=red] (0,3.25) circle (.3ex);
        %right direction below x axis
        \draw[thin, draw=black,dashed] (0,3.25)--(3,3.25) node [right] {$A$};
        \draw[scale=1,blue!90!blue,thick,rounded corners] (3,3.25) to[bend right=10] (.1,2.75) to (.1,-2.75)  to[bend right=10] (3,-3.25);
         \end{tikzpicture}
    \end{document}

如何获得如上图所示并带有箭头的精确弯曲?请帮忙。

答案1

另一种方法是增加 s 的半径rounded corner。我也会使用dot您定义的 s,同样是为了防止曲线进入点。

\documentclass[tikz, margin=3mm]{standalone}
\usetikzlibrary{arrows.meta,decorations.markings}
\begin{document}
\begin{tikzpicture}[%x=2cm,y=2cm
    dot/.style = {circle, fill=red,
                  inner sep=.3ex,node contents={}
                  }
                        ]
    \draw[-latex, thick, draw=black] (-1,0)--(4,0) node [right] {$x$};
    \draw[-latex, thick, draw=black] (0,-4)--(0,4) node [above] {$y$};
    %right direction below x axis
    \path    (0,0) node[dot,label=below left:{$O$}];
    \draw[thin, draw=black,dashed] (0,3.25) node[dot]
         --(3,3.25) node(A)[dot,label=right:{$A$}] 
         (0,-3.25) node[dot] -- (3,-3.25)node(B)[dot] ;
    \draw[blue!90!blue,thick,rounded corners=25pt,
        >={Stealth[length=3mm]},postaction=decorate,
    decoration={markings,
    mark=at position 0.2 with {\arrow{>}},
    mark=at position 0.4 with {\arrow{>}},
    mark=at position 0.6 with {\arrow{>}},
    mark=at position 0.85 with {\arrow{>}},
    }] 
     (A) to[bend right=10] (.2,2.5) -- (.2,-2.5)  
     to[bend right=10] (B);
\end{tikzpicture}
\end{document}

在此处输入图片描述

答案2

这是我的最佳成果,使用函数 $x=y^6+0.1$(更高阶的多项式将产生更“平方”的结果)。我已更改您的坐标,以便节点A位于 (1.1,1),这使得绘制曲线变得更容易一些。

\documentclass[tikz, margin=3mm]{standalone}
    \begin{document}
         \begin{tikzpicture}[scale=3,%x=2cm,y=2cm
        dot/.style = {circle, fill,
                      inner sep=.3ex,
                      }
                            ]
    \draw[-latex, thick, draw=black] (-0.1,0)--(1.25,0) node [right] {$x$};
    \draw[-latex, thick, draw=black] (0,-1.25)--(0,1.25) node [above] {$y$};
    \draw[scale=1,red,fill=red] (0, 0) circle (.3ex);
        \draw[scale=1] (0, 0) node[anchor=north east]{$O$} ;
        \draw[thin, draw=black,dashed] (0,1)--(1.1,1) node [right] {$A$};
        \draw[thin, draw=black,dashed] (0,-1)--(1.1,-1);
        \draw[scale=1,red,fill=red] (1.1,1) circle (.3ex);
        \draw[scale=1,red,fill=red] (0,1) circle (.3ex);
        \draw[scale=1,red,fill=red] (0,-1) circle (.3ex);
        %right direction below x axis
        \draw[domain=-1:1,smooth,variable=\y,blue,thick]  plot ({pow(\y, 6)+0.1},{\y});
         \end{tikzpicture}
    \end{document}

我还更改了一些元素的顺序,这样红色圆圈就位于虚线的上方。理想情况下,您可能还会在蓝色曲线之后绘制红色圆圈,但我将留给您来修复。

曲线

相关内容