我必须在 $\mathbb{R}^3$ 中重现一个与曲面相切的平面图

我必须在 $\mathbb{R}^3$ 中重现一个与曲面相切的平面图

我必须重现下图

在此处输入图片描述

编辑:下面的代码没问题。我只需要拟合切平面,gard F。

\documentclass[tikz,border=2mm]{standalone}
\usepackage{amsmath} % \boldsymbol
\usetikzlibrary{calc,decorations.pathreplacing} % decorations is for the 'underbrace'

\tikzset
{
    surface/.style={black,shading=ball,fill opacity=0.2},
    plane/.style={black!40!black,fill=black!90!black,fill opacity=0.1},
    curve/.style={black,thick},
    underbrace/.style={decorate,decoration={brace,raise=1mm,amplitude=1mm,mirror}},
}

\begin{document}
    \begin{tikzpicture}[line cap=round,line join=round,scale=2]
        % coordinates
        \coordinate (O)  at (0,0);
        \coordinate (X)  at (234:2.5);
        \coordinate (Y)  at (353:4.5);
        \coordinate (Z)  at (0,3.2);
        \coordinate (A)  at ($(O)!0.06!(Y)$);
        \coordinate (B)  at ($(A)+(0,2.8)$);
        \coordinate (C)  at ($(B)+(322:2.8)$);
        \coordinate (D)  at ($(C)+(A)-(B)$);
        \coordinate (E)  at ($(A)!0.75!(B)$);
        \coordinate (P') at ($(A)!0.27!(D)$);
        \coordinate (Q') at ($(A)!0.64!(D)$);
        \coordinate (P)  at ($(P')+(0,2.4)$);
        \coordinate (Q)  at ($(Q')+(0,2.15)$);
        \coordinate (Sx) at ($(O)!0.72!(X)$);
        \coordinate (Sy) at ($(O)!0.9!(Y)$);
        \coordinate (Sz) at ($(O)!0.62!(Z)$);
        \coordinate (T1) at ($(P)-(322:1)$);
        \coordinate (T2) at ($(P)+(322:1.3)$);
        \coordinate (R1) at ($(P')-(X)$);
        \coordinate (R2) at ($(Q')-(Y)$); 
        \coordinate (R3) at (intersection of P'--R1 and Q'--R2);
        % axes
        \draw[-latex] (O) -- (X) node (X) [left]  {$x$};
        \draw[-latex] (O) -- (Y) node (Y) [right] {$y$};
        \draw[-latex] (O) -- (Z) node (Z) [above] {$z$};
        % plane, back
        \draw[surface] (Sx) to[out=-25,in=200,looseness=0.7] (D) to[out=20,in=240,looseness=0.7] (Sy)       to[out=100,in=10] (E) to[out=190,in=20] (Sz) to[out=220,in=100] cycle;
        % plane, front
               \draw[latex-,shorten <=2mm,shorten >=4mm] (P)  -- (1.8, 2.3) node {$P(x_0,y_0,z_0)$};                       
        % curve C
        \draw[curve] (D) to[out=90,in=305] (Q) to [out=125,in=322] (P) to[out=142,in=10] (E);
        % tangent
        \draw[thick,red] (T1) -- (T2);
                % points
        \foreach\i in{P}
        \fill (\i) circle [radius=.25mm];
            \node at (-1.1,0.7) [blue]  {$S$};
        \node at  (2.1,0.7) [curve] {$C$};
    \end{tikzpicture}
\end{document}

在此处输入图片描述

答案1

在这种情况下,我会选择完整的 3D 绘图,这样更容易绘制垂直线。在“你的”代码中没有垂直线,只有水平线和垂直线,所以我使用了 2D 方法(如何在 TiKz 中绘制方向导数?)。对于这个,我将表面表示为球体的一部分。请参阅注释的辅助线。

像这样:

\documentclass[tikz,border=2mm]{standalone}
\usepackage{amsmath} % \boldsymbol
\usetikzlibrary{3d,calc,perspective}

\tikzset
{
  surface/.style={draw=blue,shading=ball,ball color=cyan!60!blue,fill opacity=0.8},
  plane/.style={draw=orange,fill=orange,fill opacity=0.6},
  vector/.style={draw=magenta,thick,-latex}
}

\begin{document}
\begin{tikzpicture}[line cap=round,line join=round,3d view={110}{20},scale=1.5]
% dimensions
\def\r{2}    % sphere radius
\def\c{0.5}  % center C position
\def\cx{0.5} % curve x position
\pgfmathsetmacro\ra{sqrt(\r*\r-\c*\c)}             % radius, arcs in the sphere
\pgfmathsetmacro\rc{sqrt(\r*\r-(\c+\cx)*(\c+\cx))} % radius, curve
\pgfmathsetmacro\axy{asin(\c/\r)}                  % angles in xy plane
\pgfmathsetmacro\ayz{asin(\c/\ra)}                 % angles in yz plane 
\pgfmathsetmacro\ar{asin((\c+\cx)/\r}              % rotation angle for plane and vectors
% coordinates
\coordinate (C) at (-\c,\c,0); % sphere center
\coordinate (O) at (0,0,0);
\coordinate (P) at (\cx,\c,{sqrt(\r*\r-(\c+\cx)*(\c+\cx))});
\coordinate (G) at ($(C)!1.7!(P)$); % gradient
% some auxiliary lines
%\begin{scope}[gray,very thin]
%  \draw (C) circle (\r cm);
%  \draw (C) --++   (\r,0,0);
%  \draw[canvas is xy plane at z=0]      (C) circle (\r);
%  \draw[canvas is xz plane at y=0]  (-\c,0) circle (\ra);
%  \draw[canvas is yz plane at x=0]   (\c,0) circle (\ra);
%  \draw[canvas is yz plane at x=\cx] (\c,0) circle (\rc);
%\end{scope}
% axes
\draw[-latex] (O) -- (\r+1,0,0) node[left]  {$x$};
\draw[-latex] (O) -- (0,\r+1,0) node[right] {$y$};
\draw[-latex] (O) -- (0,0,\r+1) node[above] {$z$};
% surface
\draw[surface] (C) ++ (-\axy:\r) arc (-\axy:90-\axy:\r)
    {[canvas is yz plane at x=0] arc (0:90+\ayz:\ra)}
    {[canvas is xz plane at y=0] arc (90-\ayz:0:\ra)};
% curve
\draw[canvas is yz plane at x=\cx,yellow] (\c+\rc,0) arc (0:{90+asin(\c/\rc)}:\rc);
% plane
\draw[plane,shift={(P)},rotate around y=\ar,canvas is xy plane at z=0] (-1,-1.5) -|++ (2,3) -| cycle;
% Point P
\fill (P) circle (0.4mm) node[below] {$P$};
% vectors
\begin{scope}[shift={(P)},rotate around y=270+\ar,canvas is xy plane at z=0]
  \draw[vector]  (0.04,0) -- (G) node[above right,black] {$\nabla F(x_0,y_0,z_0)$};
  \draw[vector]  (0,0.04) --++ (0,0.8,0) node[right,black] {$\boldsymbol{\mathrm{r}}'(t)$};
  \draw[magenta] (0,0.2) -| (0.2,0) ; 
\end{scope}
\end{tikzpicture}
\end{document}

在此处输入图片描述

相关内容