路径、圆形框架和不必要的间隙

路径、圆形框架和不必要的间隙

下面的代码生成了以下图表,其中节点框架和圆圈周围的框架之间的路径不是好的路径。有两个不必要的间隙。我该如何解决这个问题?

在此处输入图片描述

% Source
%   * https://tex.stackexchange.com/questions/101839/how-to-draw-a-venn-diagram-in-tikz
    
\documentclass[a4paper, 12pt]{scrartcl}

\usepackage{tikz}
\usetikzlibrary{positioning,fit,calc}

\begin{document}


\begin{tikzpicture}
    \node(secondcircle)
         [circle, text width = 3cm, 
          draw, ultra thick] {};

    \node(firstcircle)
         [circle, text width = 3cm, 
          left = -1cm of secondcircle,
          draw = orange, ultra thick] {};

    \node(box)
         [fit = (firstcircle)(secondcircle),
          inner sep = 1cm,
          draw, ultra thick, rounded corners] {};
    
    \node(universe) at (box.north east)
         [anchor = south west, xshift = 0.25cm, yshift = 0.25cm,
          draw, ultra thick, rounded corners] {$\Omega$};
    
    \path[draw, ultra thick]
         (box.north east) -- (universe.south west);
\end{tikzpicture}

\end{document}

答案1

一个非通用的可能解决方案是使用 使线的两端更长shorten。你只需要让线在曲线内结束。red从以下选项中删除:

\documentclass[a4paper, 12pt]{scrartcl}
\usepackage{tikz}
\usetikzlibrary{positioning,fit,calc}
\begin{document}
\begin{tikzpicture}
    \node(secondcircle)
         [circle, text width = 3cm, 
          draw, ultra thick] {};
    \node(firstcircle)
         [circle, text width = 3cm, 
          left = -1cm of secondcircle,
          draw = orange, ultra thick] {};
    \node(box)
         [fit = (firstcircle)(secondcircle),
          inner sep = 1cm,
          draw, ultra thick, rounded corners] {};
    \node(universe) at (box.north east)
         [anchor = south west, xshift = 0.25cm, yshift = 0.25cm,
          draw, ultra thick, rounded corners] {$\Omega$};
    \path[draw, red, ultra thick,shorten <=-0.1cm, shorten >=-0.1cm]
         (box.north east) -- (universe.south west);
\end{tikzpicture}
\end{document}

更长的线

相关内容