
코드는 다음과 같습니다
\documentclass[border=0.2cm]{standalone}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
% \draw [help lines] (7,0) grid (11,4);
\draw [fill=red] (0,1.3) circle (1.3);
\draw [fill=blue] plot [smooth cycle,scale=0.4, xshift=18cm, yshift=1.5cm] coordinates
{(1,0) (0,2) (1.3,4) (3.6,2) (3.6+3.6-1.3,4) (2*3.6,2) (3.6+3.6-1,0) (3.6,1)};
\draw (8.55,0.98) -- ++ (0.1,-1.47) (8.7,0.99) -- (8.55+0.1,-0.49);
\end{tikzpicture}
\end{document}
나는 올려다보았다두 선과 호 사이의 채우기 영역하지만 해결책을 찾을 수 없었습니다. 먼저 를 통해 파란색 개체에 이름을 지정해야 한다고 생각합니다 name path=candy
. 그럼 명령을 내려야지
\path[name path=twolines] (0.98) -- ++ (0.1,-1.47) (8.7,0.99) -- (8.55+0.1,-0.49);
교차점을 찾으려면. 그 후에는 명령을 사용하여 fill
해당 영역을 채울 수 있어야 합니다. 문제는 방법을 모른다는 것입니다. 아마도 의 도움을 받을 수도 있겠지만 \clip
, 다시 한번 말씀드리자면, 어떻게요?
답변1
두 가지 간단한 방법으로 작업량을 줄일 수 있습니다. 나방 모양을 그리기 전에 삼각형을 그리고 평소대로 채운 [fill=<color>]
다음 삼각형을 아주 작은 길이 위로 이동하여 호와 삼각형 면 사이의 작은 공백을 숨깁니다. 마지막으로 곡선 모양을 그려주세요. 그것은 약간의 근사치이지만 많은 두통을 덜어줄 것입니다.
\documentclass[border=0.2cm]{standalone}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
% \draw [help lines] (7,0) grid (11,4);
\draw [fill=red] (0,1.3) circle (1.3);
\draw [fill=red,yshift=1pt] (8.55,0.98) -- ++(0.1,-1.47) -- (8.7,0.99);
\draw [fill=blue] plot [smooth cycle,scale=0.4, xshift=18cm, yshift=1.5cm] coordinates
{(1,0) (0,2) (1.3,4) (3.6,2) (3.6+3.6-1.3,4) (2*3.6,2) (3.6+3.6-1,0) (3.6,1)};
\end{tikzpicture}
\end{document}
답변2
상단에 삼각형을 너무 크게 그릴 수 있습니다. 저는 shorten
길이가 음수인 옵션을 사용합니다. -다음과 같은 완벽한 결과를 얻으려면 그 위에 활을 놓으십시오.
\documentclass[border=0.2cm]{standalone}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
\draw [fill=red, shorten <=-0.1cm, shorten >=-0.1cm] (8.55,0.98) -- (8.65,-0.49) -- (8.7,0.99);
\draw [fill=blue] plot [smooth cycle,scale=0.4, xshift=18cm, yshift=1.5cm] coordinates
{(1,0) (0,2) (1.3,4) (3.6,2) (3.6+3.6-1.3,4) (2*3.6,2) (3.6+3.6-1,0) (3.6,1)};
\end{tikzpicture}
\end{document}
어떤 이유로 전경에 완벽하게 채워진 삼각형이 필요한 경우 활과 함께 @Jake의 답변에서 반전된 클립을 사용할 수 있습니다.https://tex.stackexchange.com/a/12033/8650