球面与抛物面的交点

球面与抛物面的交点

我需要帮助来绘制球面与抛物面的交点。使用它们的方程式绘制这两个表面对我来说太难了,所以我使用了以下代码:

\documentclass{article}

   \usepackage{pgfplots}
   \usepackage{tikz}
   \usetikzlibrary{calc}
   \usetikzlibrary{arrows}

\begin{document}

 \begin{tikzpicture}

     \draw node[below] at (0,0,0) {$O$} coordinate (O);

     \draw[->](0,0,0)--(0,3,0);
     \draw node[below left] at (0,3,0) {$z$};

     \draw[->](0,0,0)--(3,0,0);
     \draw node[below left] at (3,0,0) {$y$};

     \draw[->](0,0,0)--(0,0,4.5);
     \draw node[above left] at (0,0,4.5) {$x$};

     \shade[ball color = gray!40, opacity = 0.1] (0,0) circle (2cm);
     \draw[thick,black](0,0) circle (2cm);
     \draw[black](-2,0) arc (180:360:2 and 0.4);
     \draw[densely dotted] (2,0) arc (0:180:2 and 0.4) coordinate (c);
     \fill[fill=black] (0,0) circle (1pt);

     \draw[densely dotted] (-1.475,1.335) arc (170:10:1.5cm and 0.3cm) coordinate[pos=0] (a);

     \draw[black] (-1.475,1.335) arc (-170:-10:1.5cm and 0.3cm) coordinate (b);

     \draw[densely dotted,black] (a) -- (b);

     \draw[densely dotted,black] (c) -- (O);

     \fill[fill=black] (0,1.335) circle (1pt);

 \end{tikzpicture}

\end{document} 

我怎样才能模拟抛物面,如下所示: 在此处输入图片描述

此外,我将非常欣赏通过了解它们的笛卡尔/参数方程来绘制这两个表面的示例,例如x^2+y^2+z^2=3, 2*z=x^2+y^2

答案1

像这样吗?

\documentclass{article}

   \usepackage{pgfplots}
   \usepackage{tikz}
   \usetikzlibrary{calc}
   \usetikzlibrary{arrows}

\begin{document}

 \begin{tikzpicture}

     \draw node[below] at (0,0,0) {$O$} coordinate (O);

     \draw[->](0,0,0)--(0,3,0);
     \draw node[below left] at (0,3,0) {$z$};

     \draw[->](0,0,0)--(3,0,0);
     \draw node[below left] at (3,0,0) {$y$};

     \draw[->](0,0,0)--(0,0,4.5);
     \draw node[above left] at (0,0,4.5) {$x$};

     \shade[ball color = gray!40, opacity = 0.1] (0,0) circle (2cm);
     \draw[thick,black](0,0) circle (2cm);
     \draw[black](-2,0) arc (180:360:2 and 0.4);
     \draw[densely dotted] (2,0) arc (0:180:2 and 0.4) coordinate (c);
     \fill[fill=black] (0,0) circle (1pt);

     \draw[densely dotted] (-1.475,1.335) arc (170:10:1.5cm and 0.3cm) coordinate[pos=0] (a);

     \draw[black] (-1.475,1.335) arc (-170:-10:1.5cm and 0.3cm) coordinate (b);

     \draw[densely dotted,black] (a) -- (b);

     \draw[densely dotted,black] (c) -- (O);

     \fill[fill=black] (0,1.335) circle (1pt);

     \draw [variable=\x,samples=50,domain=-1.475:1.475]  plot ({\x}, {0.6*pow(\x,2)});
     \shade[top color=blue!20!white,bottom color=blue!50!white,opacity=0.75,samples=50] (1.475,1.335) -- 
        plot (-{\x}, {min(1.335,0.6*pow(\x,2))})
     -- (-1.475,1.335) arc (-170:-10:1.5cm and 0.3cm) -- cycle;
     \shade[top color=blue!20!white,bottom color=blue!50!white,opacity=0.75]
     (-1.475,1.335) arc (-170:-10:1.5cm and 0.3cm) --
     (-1.475,1.335) arc (170:10:1.5cm and 0.3cm);
 \end{tikzpicture}

\end{document} 

在此处输入图片描述

您也可以使用 TiZ 库shadings

\documentclass{article}

   \usepackage{pgfplots}
   \usepackage{tikz}
   \usetikzlibrary{calc}
   \usetikzlibrary{arrows}
   \usetikzlibrary{shadings}

\begin{document}

 \begin{tikzpicture}

     \draw node[below] at (0,0,0) {$O$} coordinate (O);

     \draw[->](0,0,0)--(0,3,0);
     \draw node[below left] at (0,3,0) {$z$};

     \draw[->](0,0,0)--(3,0,0);
     \draw node[below left] at (3,0,0) {$y$};

     \draw[->](0,0,0)--(0,0,4.5);
     \draw node[above left] at (0,0,4.5) {$x$};

     \shade[ball color = gray!40, opacity = 0.1] (0,0) circle (2cm);
     \draw[thick,black](0,0) circle (2cm);
     \draw[black](-2,0) arc (180:360:2 and 0.4);
     \draw[densely dotted] (2,0) arc (0:180:2 and 0.4) coordinate (c);
     \fill[fill=black] (0,0) circle (1pt);

     \draw[densely dotted] (-1.475,1.335) arc (170:10:1.5cm and 0.3cm) coordinate[pos=0] (a);

     \draw[black] (-1.475,1.335) arc (-170:-10:1.5cm and 0.3cm) coordinate (b);

     \draw[densely dotted,black] (a) -- (b);

     \draw[densely dotted,black] (c) -- (O);

     \fill[fill=black] (0,1.335) circle (1pt);

     \draw [variable=\x,samples=50,domain=-1.475:1.475]  plot ({\x}, {0.6*pow(\x,2)});
     \shade[upper right=blue!20!white,lower left=blue!50!white,opacity=0.75,samples=50] (1.475,1.335) -- 
        plot (-{\x}, {min(1.335,0.6*pow(\x,2))})
     -- (-1.475,1.335) arc (-170:-10:1.5cm and 0.3cm) -- cycle;
     \shade[upper left=blue!20!white,lower right=blue!50!white,opacity=0.75]
     (-1.475,1.335) arc (-170:-10:1.5cm and 0.3cm) --
     (-1.475,1.335) arc (170:10:1.5cm and 0.3cm);

     \draw[gray] (0,1.335) -- (0,1.8);
 \end{tikzpicture}

\end{document}

在此处输入图片描述

使用渐近线您不需要伪造阴影。

\usepackage{asymptote}
\begin{document}
\begin{asy}
 import graph3;
 import solids;

 size(400); 
 currentprojection=orthographic(4,0,1);
 defaultrender.merge=true;

 defaultpen(0.5mm);

 //Draw the paraboloid: call the radial coordinate r=t.x and the angle phi=t.y
 triple f(pair t) {return ((t.x)*cos(t.y), (t.x)*sin(t.y), (t.x)*(t.x) );
 }

// from https://tex.stackexchange.com/questions/227947/clipping-asymptote-3d-images

 surface s=surface(f,(-1,1),(0,2.32*pi),32,16,
          usplinetype=new splinetype[] {notaknot,notaknot,monotonic},
          vsplinetype=Spline);

 pen p=rgb(0,0,.7); 
 draw(s,rgb(.6,.6,1)+opacity(.7));
 draw(scale3(sqrt(2))*unitsphere,gray+opacity(.3)); 

\end{asy} 
\end{document}

在此处输入图片描述

相关内容