
명령을 사용하여 타원과 선의 교차 부분을 강조 표시할 수 없습니다 \clip
. 이에 대해 도움을 주십시오. 여기 ABCD 영역을 채우고 싶습니다. 안내해 주세요. 감사합니다.
\documentclass{article}
\usepackage{tikz,pgfplots}
%\usepackage[x11names]{xcolor}
\usepackage{tikz}
\usetikzlibrary{intersections}
\usepackage{pgfplots}\pgfplotsset{compat=newest}
\pgfdeclarelayer{bg} % declare background
\pgfsetlayers{bg,main} % order of layers (main = standard layer)
\pgfplotsset{compat=1.13}
\usepackage{amsmath}
\usetikzlibrary{positioning}
\begin{document}
\begin{tikzpicture}
\draw (0,-2)--(0,3);
\draw (-4,0)--(5,0);
\draw (0,0)node(o){O} (0,1)[left]node(c){C} (0,-1)node(d){D};
\draw(0,0)circle[x radius = 3 cm , y radius = 1 cm]; % DRAW ELLIPSE
\draw (1,-1)[below]node(a){A}--(1,1)[above]node(b){B};
\clip(0,0)circle[x radius = 3 cm , y radius = 1 cm];
\fill[black] (0cm,0cm) rectangle (4cm,6cm);
\draw (0,0)node(o){O} (0,1)[left]node(c){C};
\end{tikzpicture}
\end{document}
답변1
이런 걸 원하시나요? 눈에 보이는 결과를 얻지 못하는 이유는 너비가 0인 직사각형을 채우기 때문입니다.
\documentclass{article}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
\draw (0,-2)--(0,3);
\draw (-4,0)--(5,0);
\draw(0,0)circle[x radius = 3 cm , y radius = 1 cm]; % DRAW ELLIPSE
\draw (1,-1)[below]node(a){A}--(1,1)[above]node(b){B};
\clip(0,0)circle[x radius = 3 cm , y radius = 1 cm];
\draw[blue,thick] (a) -- (b);
\end{tikzpicture}
\end{document}
업데이트된 질문에 대해서는 확장 개체인 점 , 및 노드를 a
정의 b
합니다 c
. d
이것이 바로 이 지점들을 연결하는 경로에 틈이 생겨 fill
실패하는 이유입니다. 이를 방지하려면 coordinate
레이블이 있는 유형 노드를 사용하십시오.
\documentclass{article}
\usepackage{tikz}
\pgfdeclarelayer{bg}
\pgfsetlayers{bg,main}
\begin{document}
\begin{tikzpicture}
\draw (0,-2) -- (0,3);
\draw (-4,0) -- (5,0);
\draw (0,0)circle[x radius = 3 cm , y radius = 1 cm]; % DRAW ELLIPSE
\draw (1,-1)coordinate[label=below:$A$](a)
-- (1,1)coordinate[label=above:$B$](b);
\draw (0,0)coordinate[label=below left:$O$](o)
(0,1)coordinate[label=left:$C$](c)
(0,-1)coordinate[label=below:$D$](d);
\begin{pgfonlayer}{bg}
\clip (0,0) circle[x radius = 3 cm , y radius = 1 cm];
\fill[blue] (a) -- (b) -- (c) -- (d) -- cycle;
\end{pgfonlayer}
\end{tikzpicture}
\end{document}