如下图所示,我的图并没有完全反映出我所定义的上盖表面(我只是否定了参数方程的 z 坐标)
这是某种数字错误吗?
\documentclass{article}
\usepackage[a4paper,top=3cm,bottom=3cm,left=3cm,right=3cm,marginparwidth=1.75cm]{geometry}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{tikz}
\usepackage{pgfplots}
\pgfplotsset{compat=1.8}
\usepgfplotslibrary{patchplots}
\usepgfplotslibrary{colormaps}
\usetikzlibrary{arrows.meta}
\usetikzlibrary{shadings}
\usepackage{xcolor}
\usepackage{tikz-3dplot}
\begin{document}
\begin{tikzpicture}[scale=2]
\pgfmathsetmacro{\myangle}{90}
\begin{axis}[axis equal image, axis lines=none, ticks=none, view/h=120, view/v=20]
%cylindrical faces
%\addplot3[surf, shader=interp, point meta={cos(\myangle)*x+sin(\myangle)*y}, colormap={grayslate}{rgb255=(200,200,200)rgb255=(0,0,0)}, opacity=0.75, z buffer = sort, samples = 35,
%variable = \u, variable y = \v, domain = 0:360, y domain = -2:2, ] ({1+cos(u)}, {sin(u)}, {(1 + floor(-v/(abs(-v)+1)) - floor(v/(abs(v)+1)))*max(-sqrt(4 - 2*x),v)/2 + (1 + floor(v/(abs(v)+1)) - floor(-v/(abs(-v)+1)))*min(sqrt(4 - 2*x),v)/2});
%spherical faces
\addplot3[surf, shader=interp, colormap={custom}{rgb255=(100,100,100)rgb255=(250,250,250)}, z buffer = sort, samples = 35,
variable = \u, variable y = \v, domain = 0:1, y domain = 0:180] ({u(1+cos(2*v))}, {u*sin(2*v)}, {2*sqrt(1- u*u*cos(v)^2)});
\addplot3[surf, shader=interp, colormap={custom}{rgb255=(100,100,100)rgb255=(250,250,250)}, z buffer = sort, samples = 35,
variable = \u, variable y = \v, domain = 0:1, y domain = 0:180] ({u(1+cos(2*v))}, {u*sin(2*v)}, {-2*sqrt(1- u*u*cos(v)^2)});
%window
\addplot3+[domain=0:720, samples=50, samples y=0, no marks, smooth, solid, black, thin]({1+cos(x)},{sin(x)},{2*sin(x/2)});
\end{axis}\end{tikzpicture}
\end{document}
答案1
你确定你不只是在看上盖的内部吗?如果你旋转视口,你就能看到这个特征吗?