彩色椭圆相交

彩色椭圆相交

我尝试尽可能简单地为两个椭圆的截距着色。我在这里找到了一些例子:

在 tikz 中绘制具有不同颜色的椭圆作为它们的交点?

但我不确定如何将其集成到我的项目中。

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{tikz}
\usetikzlibrary{arrows}
\usetikzlibrary{shapes}
\usetikzlibrary{patterns}
\usetikzlibrary{positioning}

\begin{document}
\begin{tikzpicture}[auto,node distance=4cm,>=latex',font=\sffamily]

\node[draw=blue!40,fill=blue!15,fill opacity=0.5,ellipse,minimum width=60mm,minimum height=35mm,align=center](master) at(0,0) {A};

\node[right=-15mm of master,pattern=north west lines,pattern color=blue,draw=blue!40,fill opacity=0.5,ellipse,minimum width=60mm,minimum height=35mm,align=center](slave) {B};

\node[below right=-3mm and -2mm of master,rotate=90,fill opacity=0.5] {C};

\end{tikzpicture}
\end{document}

在此处输入图片描述

答案1

有了use path这个答案,你可以重复在这个答案

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{tikz}
\usetikzlibrary{arrows}
\usetikzlibrary{shapes}
\usetikzlibrary{patterns}
\usetikzlibrary{positioning}
\makeatletter
% from https://tex.stackexchange.com/a/127045/121799
\tikzset{use path/.code=\tikz@addmode{\pgfsyssoftpath@setcurrentpath#1}}
\makeatother
\begin{document}
\begin{tikzpicture}[auto,node distance=4cm,>=latex',font=\sffamily]

\node[draw=blue!40,fill=blue!15,fill opacity=0.5,ellipse,minimum
width=60mm,minimum height=35mm,align=center,
save path=\pathA](master) at(0,0) {A};

\node[right=-15mm of master,pattern=north west lines,pattern
color=blue,draw=blue!40,fill opacity=0.5,ellipse,minimum width=60mm,minimum
height=35mm,align=center,save path=\pathB](slave) {B};

\begin{scope}
\clip[use path=\pathA];
\fill[red] [use path=\pathB];
\end{scope}

\node[below right=-3mm and -2mm of master,rotate=90,fill opacity=0.5] {C};

\end{tikzpicture}
\end{document}

在此处输入图片描述

相关内容