此图中有两个椭圆:一个蓝色椭圆,位于六边形上方,另一个橙色椭圆,位于六边形下方。如何让六边形隐藏下方的橙色椭圆部分?
\documentclass[12pt]{article}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage[full]{textcomp}
\usepackage{subcaption}
\usepackage{tikz}
\usetikzlibrary{arrows.meta,
positioning,
fit}
\begin{document}
\begin{figure}
\centering
\begin{tikzpicture}[
>={Stealth},line width=0.25px
]
\draw[->,orange,thick] (0,-0.75) arc [start angle=270,
end angle=-90,
x radius=2.5,
y radius =0.75];
\draw[thick] (2,-1) -- (-2,-1);
\draw[thick] (-2,-1) -- (-3,0);
\draw[densely dotted] (-3,0) -- (-2,1);
\draw[densely dotted] (-2,1) -- (2,1);
\draw[densely dotted] (2,1) -- (3,0);
\draw[thick] (3,0) -- (2,-1);
\draw[->,orange,thick] (0,-1.5) arc [start angle=270,
end angle=-90,
x radius=2.5,
y radius =0.75];
\end{tikzpicture}
\end{figure}
\end{document}
答案1
简单的方法是按另一种顺序绘制圆圈,然后放置一个白色不透明的六边形,然后再绘制其周围的六边形边界,如下所示:
\documentclass[12pt]{article}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage[full]{textcomp}
\usepackage{subcaption}
\usepackage{tikz}
\usetikzlibrary{arrows.meta,positioning,fit}
\begin{document}
\begin{figure}
\centering
\begin{tikzpicture}[>={Stealth},line width=0.25px]
\draw[->,orange,thick] (0,-1.5) arc [start angle=270,
end angle=-90,
x radius=2.5,
y radius =0.75];
\fill[white] (2,-1) -- (-2,-1) -- (-3,0) -- (-2,1) -- (2,1) -- (3,0)
-- cycle;
\draw[thick] (0,-1) -- (-2,-1) -- (-3,0);
\draw[densely dotted] (-3,0) -- (-2,1) -- (2,1) -- (3,0);
\draw[thick] (3,0) -- (2,-1) -- (0,-1);
\draw[->,orange,thick] (0,-0.75) arc [start angle=270,
end angle=-90,
x radius=2.5,
y radius =0.75];
\end{tikzpicture}
\end{figure}
\end{document}
我重新绘制了你的六边形,从中间开始,并在角落处连接线段,但据我所知,当线从实线变为虚线时,没有简单的方法可以避免断开的角。