我必須在 $\mathbb{R}^3$ 中重現曲面的切平面圖形

我必須在 $\mathbb{R}^3$ 中重現曲面的切平面圖形

我必須重現下圖

在此輸入影像描述

編輯:下面的程式碼就OK了。只是我必須擬合切平面,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 繪圖,這樣更容易繪製垂直線。在「你的」程式碼中沒有垂直線,只有水平線和垂直線,所以我使用了二維方法(如何在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}

在此輸入影像描述

相關內容