我想要复制下图。
我尝试了如下操作
\tdplotsetmaincoords{65}{120}
\begin{tikzpicture}[tdplot_main_coords]
\draw[-stealth] (0,0,0) -- (4,0,0) node[right] {$x$};
\draw[-stealth] (0,0,0) -- (0,4,0) node[above] {$y$};
\draw[-stealth] (0,0,0) -- (0,0,4) node[below left] {$z$};
\shade[ball color=blue!40!white,opacity=0.5] (3,0) arc (0:90:3) {[x={(0,0,1)}] arc (90:0:3)} {[y={(0,0,1)}] arc (90:0:3)};
\end{tikzpicture}
有人能帮助我吗?提前致谢。
答案1
我认为这里的关键是把所有点(其坐标)放在哪里。这可以是一个很好的例子,说明如何使用calc
允许将一个坐标相对于另一个坐标定位的库。在我看来,最好在 2d 中绘制这个。
例如:
\documentclass[tikz,border=2mm]{standalone}
\usepackage{amsmath} % \boldsymbol
\usetikzlibrary{calc,decorations.pathreplacing} % decorations is for the 'underbrace'
\tikzset
{
surface/.style={blue,shading=ball,fill opacity=0.4},
plane/.style={green!40!black,fill=green!30!black,fill opacity=0.3},
curve/.style={blue,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[plane] (D) to[out=90,in=305] (Q) to [out=125,in=322] (P) to[out=142,in=10] (E) -- (A) -- cycle;
% surface S
\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[plane] (D) to[out=90,in=305] (Q) to [out=125,in=322] (P)
to[out=142,in=10] (E) -- (B) -- (C) -- cycle;
% 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);
% triangle
\draw[dashed] (P) -- (P') -- (R3) node[pos=0.4,left] {$ha$} -- (Q') node[midway,below] {$hb$} -- (Q);
\draw (R3) ++ (54:0.1) --++ (353:0.15) -- ($(R3)+(353:0.15)$);
% vector
\draw[thick,red,-latex] (P') -- ($(P')!0.7!(D)$) node [midway,yshift=3mm] {$\boldsymbol{\mathrm{u}}$};
% points
\foreach\i in{P',Q',P,Q}
\fill (\i) circle [radius=.25mm];
% labels
\draw[latex-,shorten <=2mm,shorten >=4mm] (P) -- (1.8, 2.3) node {$P(x_0,y_0,z_0)$};
\draw[latex-,shorten <=2mm,shorten >=2mm] (Q') -- (1.6,-1.6) node {$Q'(x,y,0)$};
\draw[underbrace] (P') -- (Q') node [pos=0.3,yshift=-5mm] {$h$};
\node at (Q) [right] {$Q(x,y,z)$};
\node at (P') [left] {$P'(x_0,y_0,0)$};
\node at (T1) [below] {$T$};
\node at (-1.1,0.7) [blue] {$S$};
\node at (2.1,0.7) [curve] {$C$};
\end{tikzpicture}
\end{document}