在 tikz 中绘制八分之一球体

在 tikz 中绘制八分之一球体

使用 Tikz 绘制像这样的八分之一球体的最佳方法是什么?在此处输入图片描述我发现了很多绘制球体的方法,但绘制球体的一部分却并非如此。这个问题是我最接近的,到目前为止我从未使用过 3D tikz 图。(使用 tikz 绘制阴影半球?

答案1

使用该tikz-3dplot包,您可以轻松旋转平面,从而方便绘图。但实际上,您只需要在三个平面(xy、xz 和 yz)上绘制三个四分之一圆,并用不同的灰色阴影对其进行着色:

\documentclass[border=10pt]{standalone}
\usepackage{tikz}
\usepackage{tikz-3dplot}

\begin{document}
\tdplotsetmaincoords{60}{110}

\begin{tikzpicture}[scale=3, tdplot_main_coords]

% quarter circle on xy plane
\draw[fill=gray] (1,0,0) arc (0:90:1) -- (0,0,0) -- cycle;

% quarter circle on xz plane
\tdplotsetthetaplanecoords{0}
\draw[fill=lightgray, tdplot_rotated_coords] (1,0,0) arc (0:90:1) -- (0,0,0) -- cycle;

% quarter circle on yz plane
\tdplotsetthetaplanecoords{90}
\draw[fill=lightgray!75, tdplot_rotated_coords] (1,0,0) arc (0:90:1) -- (0,0,0) -- cycle;

\end{tikzpicture}

\end{document}

在此处输入图片描述

答案2

作为参考,在 Asymptote 中,我们可以使用

  • 第一种方式:内置的octant1是球体的前 8 个表面,可以用draw(octant1,yellow);

  • 第二种方式:具有适当值的球面参数方程,在这种情况下(theta,phi)(0,0)(90,90)

在此处输入图片描述

// http://asymptote.ualberta.ca/
import graph3;
size(200,0);
currentprojection=orthographic(4,1,2,center=true,zoom=.8);

real R=2;
// parametric equations for the first octant
triple f(pair t) {
  return ((R*cos(t.y))*cos(t.x),
          (R*cos(t.y))*sin(t.x),
          R*sin(t.y));
}

pen p=green+opacity(.5);   // surface pen
pen q=red;                 // mesh pen  
surface s=surface(f,(0,0),(pi/2,pi/2),8,8,Spline);

// mesh only
//draw(s,nullpen,meshpen=q);

// surface & mesh
draw(s,p,meshpen=q,render(merge=true));

查看更多3D 渐近线画廊, 尤其,单位八分法单位八分之一

在此处输入图片描述

// Run on http://asymptote.ualberta.ca/
size(5cm);
import three; 
currentprojection=orthographic(2,1,1,zoom=.8,center=true);
triple A=(1,0,0),B=(0,1,0),C=(0,0,1);
path3 arcAB=arc(O,A,B,Z);
path3 arcBC=arc(O,B,C,X);
path3 arcCA=arc(O,C,A,Y);
pen p=yellow+opacity(.5);
pen q=brown+.8pt;

draw(surface(O--A--arcAB--cycle),p);
draw(surface(O--B--arcBC--cycle),p);
draw(surface(O--C--arcCA--cycle),p);
draw(O--A^^O--B^^O--C,q);
draw(arcAB^^arcBC^^arcCA,q);

// octant1 is the first 8th part of the sphere
draw(octant1,p);
// draw(octant1,nu=10,nv=5,material(p,shininess=0.5),gray);

如果想要一些网格线draw(octant1,nu=10,nv=5,material(p,shininess=0.5),gray);

在此处输入图片描述

相关内容