绘制两个弯曲的箭头,中间有一个椭圆

绘制两个弯曲的箭头,中间有一个椭圆

我怎样才能绘制两个弯曲的箭头,并在它们之间画两个椭圆,如附图所示?在此处输入图片描述

答案1

为了得到更好的结果,椭圆的长轴必须与两条曲线垂直。这里我使用 Mathematica 以数字方式找到坐标。

F[x_] := x^3/4 + 1;
G[x_] := (x - 1/2)^3/5 + 1/6;
Plot[{F[x], G[x]}, {x, -2, 4}]
Solve[{F'[a] == G'[b], F'[a] == (b - a)/(F[a] - G[b])}, {a, b}] // N

最大工作示例

\documentclass[pstricks,border=12pt,dvipsnames]{standalone}
\usepackage{pst-plot,pst-eucl}

\def\f{x^3/4+1}
\def\g{(x-1/2)^3/5+1/6}


\psset
{
    algebraic,
    saveNodeCoors,
    NodeCoorPrefix=N,
    PointName=none,
    PointSymbol=none,
}

\def\Ellipse(#1,#2){%
    \pstGeonode(*#1 {\f}){F}(*#2 {\g}){G}
    \pstMiddleAB{F}{G}{H}
    \pcline[nodesep=-.5,linecolor=ForestGreen!50](F)(G)% you can comment this line to remove the normal line
    \psellipse[rot={!NGy NFy sub NGx NFx sub atan}](H)(!NGy NFy sub 2 exp NGx NFx sub 2 exp add sqrt 2 div dup 4 div)
}

\begin{document}
\begin{pspicture}[showgrid=true](-2,-1)(5,9)
    \begingroup
        \psset{arrows=->,linecolor=NavyBlue}
        \psplot{-1.8}{3.15}{\f}
        \psplot{-1.3}{4.0}{\g}
    \endgroup
    \Ellipse(-0.798555,-0.392812)
    \Ellipse(0.221492,0.252365)
    \Ellipse(1.01476,1.63454)
    \Ellipse(2.86997,3.70873)
\end{pspicture}
\end{document}

在此处输入图片描述

最终版本

\documentclass[pstricks,border=12pt,dvipsnames]{standalone}
\usepackage{pst-plot,pst-eucl}

\def\f{x^3/4+1}
\def\g{(x-1/2)^3/5+1/6}


\psset
{
    algebraic,
    saveNodeCoors,
    NodeCoorPrefix=N,
    PointName=none,
    PointSymbol=none,
}

\def\Ellipse(#1,#2){%
    \pstGeonode(*#1 {\f}){F}(*#2 {\g}){G}
    \pstMiddleAB{F}{G}{H}
    \psellipse[rot={!NGy NFy sub NGx NFx sub atan}](H)(!NGy NFy sub 2 exp NGx NFx sub 2 exp add sqrt 2 div dup 3 div)
}

\begin{document}
\begin{pspicture}[showgrid=false](-2,-1)(4,8)
    \begingroup
        \psplot{-1.8}{3.0}{\f}
        \psplot{-1.0}{3.85}{\g}
    \endgroup
    \psset{opacity=0.5}
    \begingroup
        \psset{fillstyle=solid,fillcolor=Cyan}
        \Ellipse(-0.798555,-0.392812)
    \endgroup
    \uput[90](F){$\textrm{d}S_1$}   
    \begingroup
        \psset{fillstyle=solid,fillcolor=ForestGreen}
        \Ellipse(0.221492,0.252365)
    \endgroup
    \uput[90](F){$\textrm{d}S_2$}
    \begingroup
        \psset{fillstyle=solid,fillcolor=Orange}
        \Ellipse(1.01476,1.63454)
    \endgroup
    \uput{6pt}[45](H){$\textrm{d}S_3$}
    \begingroup
        \psset{fillstyle=solid,fillcolor=Maroon}
        \Ellipse(2.86997,3.70873)
    \endgroup
    \uput{6pt}[90](H){$\textrm{d}S_4$}
\end{pspicture}
\end{document}

在此处输入图片描述

答案2

这是使用 tikz 技能---命令的尝试\draw let ... in ...

  1. 该管道由两段(蓝色和红色)通过 [向左弯曲] 和 [向右弯曲] 曲线构成。
  2. 使用 pos=xx 确定椭圆的接触点,分别标记为(a)和(b),然后计算距离确定长半径,短半径是长半径的 0.3 倍。
  3. 需要通过 atan2 找到旋转角度
  4. 定义了两个宏,采用两个位置参数来设置 (a) 和 (b) 点。这两个宏基本上是相同的,只是段不同。

在此处输入图片描述

代码

\documentclass[2cm]{standalone}
\usepackage{tikz}
\usetikzlibrary{positioning,arrows,calc}


\begin{document}
\newcommand{\ellpsA}[2]{
\draw[->,>=stealth] (0,0) to[bend left]node[pos=#1](a){} (2,2) to[bend right](4,4);
\draw[->,>=stealth] (1,0) to[bend left]node[pos=#2](b){} (2,1) to[bend right] (5,3);
\path (a) --node[midway](centeri){} (b); 
\draw[blue] let \p1=($(a)-(b)$),             % find distance
                \n1={veclen(\x1,\y1)*0.5},   % find radius
                \n2={atan2(\x1,\y1)}         % find rotation angle
            in 
            [rotate=\n2] (centeri) ellipse (\n1 and \n1*0.3);  
}

\newcommand{\ellpsB}[2]{
\draw[->,>=stealth] (0,0) to[bend left] (2,2) to[bend right]node[pos=#1](a){}(4,4);
\draw[->,>=stealth] (1,0) to[bend left] (2,1) to[bend right]node[pos=#2](b){} (5,3);
\path (a) --node[midway](centerii){} (b); 
\draw[red] let \p1=($(a)-(b)$),
               \n1={veclen(\x1,\y1)*0.5},
               \n2={atan2(\x1,\y1)}
           in 
           [rotate=\n2] (centerii) ellipse (\n1 and \n1*0.3); 
}
\begin{tikzpicture}

% On first segment A

\ellpsA{0}{0}
\ellpsA{0.5}{0.5}
\ellpsA{0.99}{0.99}


% On second segment B

\ellpsB{0.01}{0.01}
\ellpsB{0.3}{0.5}
\ellpsB{1}{1}

\end{tikzpicture}
\end{document}

答案3

在此处输入图片描述

Asymptote MWE

端点pq定义为位于曲线总长度(arclength)的一小部分的底部和顶部曲线上的点,沿曲线,然后drawEll使用函数来变换unitcircle以将其放置在p和之间qel.asy

import graph; import fontsize;
size(6cm);

defaultpen(fontsize(9pt));
pen linepen=deepblue+1bp;
pen elpen=orange+0.6bp;

texpreamble("\usepackage{lmodern}");

pair[] pbot={(23,8),(108,70),(146,81),(194,83),(269,118),(316,174),};
pair[] ptop={(10,33),(88,107),(130,125),(178,136),(241,184),(278,242),};

guide gtop, gbot;

for(int i=0;i<ptop.length;++i){
  gtop=gtop..ptop[i];
  gbot=gbot..pbot[i];
}

arrowbar arr=Arrow(HookHead,size=6);

void drawEll(pair p, pair q, pen fillpen, pen drawpen){ // draws an ellipse between p and q
  real a=abs(p-q), fr=0.382;
  path el=shift(p+(q-p)/2)*rotate(degrees(dir(q-p)))*scale(a/2,a*fr/2)*unitcircle;
  filldraw(el,fillpen, drawpen);
}

draw(gtop,linepen,arr);
draw(gbot,linepen,arr);

real[] pathfrac={0, 0.318, 0.682, 0.9}; // fractions of the curve length
                                      //    to locate points
pair p; // point on the bottom curve
pair q; // point on the top curve

pen[] fillpen={lightred, lightgreen, lightblue};
pen[] drawpen={deepred, deepgreen, deepblue};

for(int i=0;i<pathfrac.length;++i){
  p=relpoint(gbot,pathfrac[i]);
  q=relpoint(gtop,pathfrac[i]);
  drawEll(p,q,fillpen[i%fillpen.length],drawpen[i%drawpen.length]);
  label("$dS_{"+string(i)+"}$",q,NW);
}

逃跑。el.pdfasy -f pdf el.asy

答案4

这是一个简单的方法元帖子采用便捷的direction .. of ..构造。

在此处输入图片描述

为了得到一个椭圆,我使用了fullcircle xscaled xx yscaled yy,并利用了其路径上有 8 个点(point 03 点和point 49 点)的事实。我定义了四个椭圆,但其中两个是不可见的。

prologues := 3;
outputtemplate := "%j%c.eps";

beginfig(1);

u := 1mm;

path ds[];  
ds1 = fullcircle xscaled 5u yscaled u rotated -50; 
ds2 = ds1 scaled 1.4 rotated -5 shifted (20u,9u);
ds0 = ds1 scaled 0.9 shifted (-10u,-10u);
ds3 = ds1 scaled 1.5 rotated 10 shifted (32u,28u);

% draw only the two we want visible
draw ds1; draw ds2;

% draw arrows tangent to extremes of the ellipses
drawarrow point 0 of ds0 for i=1 upto 3: .. { direction 0 of ds[i] } point 0 of ds[i] endfor;
drawarrow point 4 of ds0 for i=1 upto 3: .. { direction 0 of ds[i] } point 4 of ds[i] endfor;

label.ulft(btex $dS_1$ etex, point 4 of ds1);
label.ulft(btex $dS_2$ etex, point 4 of ds2);

endfig;
end.

相关内容