球面三角形和大圆

球面三角形和大圆

我想绘制一个无阴影球体(只有一个圆形边框)的图像,其中有三个相交的大圆,可见面是实线,背面是虚线。此外,我希望能够标记角度、边和点以及半径。

最后我需要能够绘制如下图像这个

在此处输入图片描述

PS:我已经搜索了许多有关 TikZ 和其他软件包的教程,主要问题是我无法绘制除经度或纬度圆之外的圆。

我感谢任何能提供解决方案的教程或示例文档。

答案1

绘制起来很容易,但填充起来却很困难,因为 tikz 中的湖泊很大,使用路径尤其要沿着它们绘制。使用 metapost 就轻而易举了。这里计算了交叉点,但我不知道如何沿着路径绘制一个循环,而 buildcycle 在 metapost 中用一个命令就可以完成这个任务……

使用 Metapost(参见下面的代码):

在此处输入图片描述

使用 Tikz :

在此处输入图片描述

\documentclass[tikz]{standalone}
\usetikzlibrary{intersections}

\newcommand{\InterSec}[3]{%
    \path[name intersections={of=#1 and #2, by=#3, sort by=#1,total=\t}]
        \pgfextra{\xdef\InterNb{\t}}; }

\begin{document}
\begin{tikzpicture}

\draw[thick] (0,0) circle (2) ;

\foreach \angle[count=\n from 1] in {-5,225,290} {

    \begin{scope}[rotate=\angle]
    \path[draw,dashed,name path global=d\n] (2,0) arc [start angle=0,
                            end angle=180,
                            x radius=2cm,
                            y radius=1cm] ;
    \path[draw,name path global=s\n] (-2,0) arc [start angle=180,
                        end angle=360,
                        x radius=2cm,
                        y radius=1cm] ;
    \end{scope}
    }

    \InterSec{s1}{s2}{I3} ;
    \InterSec{s1}{s3}{I2} ;
    \InterSec{s3}{s2}{I1} ;
    \fill[red] (I1)--(I2)--(I3)--cycle ;

    \InterSec{d1}{d2}{J3} ;
    \InterSec{d1}{d3}{J2} ;
    \InterSec{d3}{d2}{J1} ;
    \fill[blue] (J1)--(J2)--(J3)--cycle ;

\end{tikzpicture}
\end{document}

Metapost 代码:

prologues := 2 ;
verbatimtex
%&latex
\documentclass[10pt]{article}
\usepackage{amsmath,amsfonts,amssymb}
\begin{document}
\scriptsize
etex;

%input Macros-nk ;

u := 1.5cm ;

%##############
\beginfig(1) %#
%##############

path p[] ;

draw fullcircle scaled 4u withpen pencircle scaled 1pt ;

p0 := halfcircle scaled 4u yscaled .5;

for i=0 upto 2 :
    p[i+1] := p0 rotated (-5+60*i) ;
    p[i+4] := p0 rotated (-5+60*i+180) ;
    endfor 

fill buildcycle(p1,p2,p3) withcolor .7[red,white] ;
fill buildcycle(p4,p5,p6) withcolor .7[blue,white] ;

z1 = p1 intersectionpoint p2 ;
z2 = p2 intersectionpoint p3 ;
z3 = p3 intersectionpoint p1 ;

for i=1 upto 2 :
    draw p[i] withpen pencircle scaled .3pt ;
    draw p[i+3] withpen pencircle scaled .3pt dashed evenly scaled .5;
    draw z[i]--(-z[i]) withpen pencircle scaled .3pt dashed evenly ;    
    endfor 

draw halfcircle scaled (.6*u) rotated 90 shifted z1
        cutafter p2 cutbefore p1
        withpen pencircle scaled .1pt ; 
draw halfcircle scaled (.6*u) shifted z2
        cutafter p3 cutbefore p2
        withpen pencircle scaled .1pt ; 
draw halfcircle scaled (.45*u) rotated -90 shifted z3
        cutafter p1 cutbefore p3
        withpen pencircle scaled .1pt ; 

label(btex $\alpha$ etex , z1 shifted (-.2u,-.1u)) ;
label(btex $\beta$ etex , z2 shifted (0u,.2u)) ;
label(btex $\gamma$ etex , z3 shifted (.1u,-.1u)) ;

%##############
endfig;      %#1
%##############

end

答案2

以下是基于 的首次尝试回答,tikz-3dplot如上文 @Manuel 所建议的。考虑以下 MWE:

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

\begin{document}
\pgfmathsetmacro{\alpha}{55}
\pgfmathsetmacro{\beta}{60}
\tdplotsetmaincoords{\alpha}{\beta} % Perspective on the main coordinate system
\pgfmathsetmacro{\radius}{0.8} % radius of the circle

\begin{tikzpicture}[scale=5,tdplot_main_coords]
% Draw circle in the un-rotated coordinates
\draw[blue,tdplot_screen_coords] (0,0,0) circle (\radius);

% draw coordinate vectors for reference
\draw[->] (-1,0,0) -- (1,0,0) node[anchor=north east]{$x$};
\draw[->] (0,-1,0) -- (0,1,0) node[anchor=north west]{$y$};
\draw[->] (0,0,-1) -- (0,0,1) node[anchor=south]{$z$};

% draw the "visible" and  "hidden" portions of the circumference as a solid and dashed semi-circles, parametrically 
\draw[red,domain={-180+\beta}:\beta] plot ({\radius*cos(\x)}, {\radius*sin(\x)});
\draw[red,dashed,domain=\beta:{180+\beta}] plot ({\radius*cos(\x)}, {\radius*sin(\x)});

% Change coordinate system, rotate about the reference x and y axis
\tdplotsetrotatedcoords{40}{60}{0} 
\draw [green,tdplot_rotated_coords,domain=160:340] plot ({\radius*cos(\x)}, {\radius*sin(\x)});
\draw [green,dashed,tdplot_rotated_coords,domain=-20:160] plot ({\radius*cos(\x)}, {\radius*sin(\x)});
\end{tikzpicture}

\end{document}

结果是

在此处输入图片描述

我改编了tikz-3dplot 手动的要定义三维坐标系,请在其上绘制两个半圆(一个实线,一个虚线)。然后我更改坐标系以生成相交的圆。

它可能是您所需要的基础:我需要计算出在新的坐标系中实心半圆应该与虚线半圆相交的位置,以及如何用不同的颜色填充相交处。

编辑:我改变了坐标系的更新方式。此外,我按照建议的步骤绘制了半圆当指定圆心时在 tikz 中绘制圆弧

答案3

\documentclass{article}
\usepackage{pst-3dplot}   
\begin{document}

\def\radius{4 }\def\PhiI{20 }\def\PhiII{50 }
\def\RadIs{\radius \PhiI sin mul}
\def\RadIc{\radius \PhiI cos mul}

\begin{pspicture}(-4,-4)(4,5)
  \psset{Alpha=45,Beta=30,linestyle=dashed}
  \pstThreeDSphere[linecolor=black!15](0,0,0){4}
  \pstThreeDCoor[linestyle=solid,xMin=-5,xMax=5,yMax=5,zMax=5,IIIDticks]
  \pstThreeDEllipse(\RadIs,0,0)(0,\RadIc,0)(0,0,\RadIc)
  \pstThreeDEllipse[SphericalCoor](0,0,0)(\radius,90,\PhiI)(\radius,0,0)
  \pstThreeDEllipse[SphericalCoor](0,0,0)(\radius,90,\PhiII)(\radius,0,0)
%
  \psset{linecolor=blue,arrows=->,arrowscale=2,linewidth=1.5pt,linestyle=solid}
    \pstThreeDEllipse[SphericalCoor,beginAngle=\PhiI,endAngle=90]%
    (0,0,0)(\radius,90,\PhiII)(\radius,0,0)
    \pstThreeDEllipse[SphericalCoor,beginAngle=90,endAngle=\PhiI]%
    (0,0,0)(\radius,90,\PhiI)(\radius,0,0)
    \pstThreeDEllipse[beginAngle=\PhiI,endAngle=\PhiII](\RadIs,0,0)(0,\RadIc,0)(0,0,\RadIc)
  \pscustom[fillstyle=solid,fillcolor=blue!40,opacity=0.4]{
    \pstThreeDEllipse[SphericalCoor,beginAngle=\PhiI,endAngle=90]%
    (0,0,0)(\radius,90,\PhiII)(\radius,0,0)
    \pstThreeDEllipse[SphericalCoor,beginAngle=90,endAngle=\PhiI]%
    (0,0,0)(\radius,90,\PhiI)(\radius,0,0)
    \pstThreeDEllipse[beginAngle=\PhiI,endAngle=\PhiII](\RadIs,0,0)(0,\RadIc,0)(0,0,\RadIc)
  }
\end{pspicture}

\end{document}

在此处输入图片描述

相关内容