绘制球面与平面的交点

绘制球面与平面的交点

我必须在 3D 坐标系中绘制以 (1,0,0) 为中心、半径为 1 的球体(即 )(x-1)^2+y^2+z^2=1与平面 的交点x=z,该平面在 xOy 上的投影是一个椭圆。

该交叉点的参数方程是(感谢@marmot):

x=1/2+1/2*cos(t), y=1/sqrt(2)*sin(t), z=1/2+1/2*cos(t), t\in [0,2*pi].

绘制交叉点的代码是:

\documentclass{article}
\usepackage{pgfplots}
\pgfplotsset{compat=1.15}
\usetikzlibrary{decorations.markings}

\begin{document}

\begin{figure}[h]
\begin{tikzpicture}[
    arrow inside/.style = {
      postaction={decorate},
      decoration={
        markings,
        mark=at position #1,
      }
    }]
        \begin{axis}
               [view={60}{30}, axis lines=center,axis on top,
                xlabel=$x$,ylabel=$y$,zlabel=$z$,
                 xtick={100},ytick={100},ztick={100},
                no marks,axis equal,
                xmin=-.5,xmax=1.5,ymin=-.5,ymax=1.5,zmin=-.5,zmax=1.5,
                enlargelimits={upper=0.1}]
            \addplot3+[color=black, no markers,samples=1001, samples y=0, domain=0:2*pi, variable=\t, arrow inside=.2 with {\arrow[rotate=180]{latex}}] ({1+cos(\t r)}, {sqrt(2)*sin(\t r)}, {1+cos(\t r)});

            \path node[below left] at (0,0,0) {$O$} ;

       \end{axis}

 \end{tikzpicture}

\end{figure}

\end{document} 

输出为在此处输入图片描述

如何在同一坐标系上绘制初始球体?

稍后编辑:通过使用@marmot 提供的代码,输出是: 在此处输入图片描述

答案1

我猜测这个问题之所以没有得到你所希望的关注是因为“椭圆”的参数化似乎存在问题。

\documentclass{article}
\usepackage{amsmath}
\usepackage{tikz}
\usepackage{pgfplots}
\pgfplotsset{compat=1.15}
\usetikzlibrary{decorations.markings}

\begin{document}

The intersection between the plane $x=z$ and the circle at $(1,0,0)$ can be
parametrized as
\[ x=z=\frac{1}{2}+\frac{1}{2}\cos t \quad\text{and}\quad
  y=\frac{1}{\sqrt{2}}\sin t\;.
\]
\begin{center}
\begin{tikzpicture}[
    arrow inside/.style = {
      postaction={decorate},
      decoration={
        markings,
        mark=at position #1,
      }
    }]
        \begin{axis}
               [view={60}{30}, axis lines=center,axis on top,
                xlabel=$x$,ylabel=$y$,zlabel=$z$,
                 xtick={100},ytick={100},ztick={100},
                no marks,axis equal,
                xmin=-.5,xmax=1.5,ymin=-.5,ymax=1.5,zmin=-.5,zmax=1.5,
                enlargelimits={upper=0.1}]
            \addplot3+[color=black, no markers,samples=1001, samples y=0,
            domain=0:2*pi, variable=\t, arrow inside=.2 with
            {\arrow[rotate=180]{latex}}] ({1/2+cos(\t r)/2}, {sin(\t
            r)/sqrt(2)}, {1/2+ cos(\t r)/2});
            \path node[below left] at (0,0,0) {$O$} ;
    \shade[ball color=blue!10!white,opacity=0.20] (axis cs:1,0,0) circle (1.2cm);
     % Sadly, I had to adjust the radius of the sphere by hand
        \end{axis}
\end{tikzpicture}
\end{center}
\end{document}

在此处输入图片描述

如您所见,我必须手动调整半径。所以这是完整答案的起点。您也可以使用具有真正 3D 引擎的渐近线。

更新使用渐近线可以相当容易地绘制这些东西。

 \documentclass{standalone}
 \usepackage[inline]{asymptote}
 \begin{document}
 \thispagestyle{empty}
 \begin{asy}
    import three;
    import graph3;
    size(200);
    currentprojection=orthographic(-3,-4,1);
    // axes
    real r=3.5;
    draw(Label("$x$",1), O--r*X, Arrow3(HookHead3));
    draw(Label("$y$",1), O--r*Y, Arrow3(HookHead3));
    draw(Label("$z$",1), O--r*Z, Arrow3(HookHead3));
    // sphere
    draw(shift(1,0,0)*unitsphere,green,render(compression=Zero,merge=true));
    // plane
    pen bg=gray(0.9)+opacity(0.5);
    draw(scale3(2)*surface((-1,-1,-1)--(1,-1,1)--(1,1,1)--(-1,1,-1)--cycle),bg);
    //
    real x(real t) {return 0.5+0.5 cos(t);}
    real y(real t) {return sin(t)/sqrt(2);}
    real z(real t) {return 0.5+0.5 cos(t);}
    path3 p=graph(x,y,z,0,2*pi,operator ..);
    draw(p,Arrow3);
 \end{asy}
 \end{document}

在此处输入图片描述

答案2

如果创建所有三个图像,则需要一些时间。使用xelatex或运行它latex->dvips->ps2psdf

\documentclass[pstricks]{standalone}
\usepackage{pst-solides3d}    
\begin{document}

\begin{pspicture}[solidmemory](-4,-2)(4,4)
\psset{viewpoint=50 170 20 rtp2xyz,Decran=70,lightsrc=viewpoint}
\axesIIID(7,2.5,2.5)
\psSolid[object=plan,definition=equation,args={[-1 0 1 0]},base=-1 2 -2 2,
  ngrid=40 40,fillcolor=red!30,linewidth=0pt,name=B1,action=none]
\psSolid[object=sphere,r=1,fillcolor=cyan,ngrid=72 72,name=C1,action=none](1,0,0)
\psSolid[object=fusion,linewidth=0.01pt,base=B1_s C1,linewidth=0.01pt,]
\defFunction[algebraic]{Circle}(t){0.5+0.5*cos(t)}{1/sqrt(2)*sin(t)}{0.5+0.5*cos(t)}
\psSolid[object=courbe,r=0,function=Circle,range=0 6.3,linecolor=red,linewidth=1.5pt]
\end{pspicture}

\begin{pspicture}[solidmemory](-4,-3)(2,4)
\psset{viewpoint=50 100 10 rtp2xyz,Decran=70,lightsrc=-20 50 20}
\axesIIID(2.5,6,2)
\psSolid[object=plan,definition=equation,args={[-1 0 1 0]},base=-1 2 -2 2,
  ngrid=40 40,fillcolor=red!30,linewidth=0pt,name=B1,action=none]
\psSolid[object=sphere,r=1,fillcolor=cyan,ngrid=72 72,name=C1,action=none](1,0,0)
\psSolid[object=fusion,linewidth=0.01pt,base=B1_s C1,linewidth=0.01pt,]
\defFunction[algebraic]{Circle}(t){0.5+0.5*cos(t)}{1/sqrt(2)*sin(t)}{0.5+0.5*cos(t)}
\psSolid[object=courbe,r=0,function=Circle,range=0 3.14,linecolor=red,linewidth=1.5pt]
\end{pspicture}

\begin{pspicture}[solidmemory](-4,-3)(2,4)
\psset{viewpoint=50 90 10 rtp2xyz,Decran=70,lightsrc=-50 20 20}
\axesIIID(2.5,6,2)
\psSolid[object=plan,definition=equation,args={[-1 0 1 0]},base=-1 2 -2 2,
  ngrid=40 40,fillcolor=red!30,linewidth=0pt,name=B1,action=none]
\psSolid[object=sphere,r=1,fillcolor=cyan,ngrid=72 72,name=C1,action=none](1,0,0)
\psSolid[object=fusion,linewidth=0.01pt,base=B1_s C1,linewidth=0.01pt,]
\defFunction[algebraic]{Circle}(t){0.5+0.5*cos(t)}{1/sqrt(2)*sin(t)}{0.5+0.5*cos(t)}
\psSolid[object=courbe,r=0,function=Circle,range=0 3.14,linecolor=red,linewidth=1.5pt]
\end{pspicture}

\end{document}

在此处输入图片描述 在此处输入图片描述 在此处输入图片描述

相关内容