타원 그리기 관련 문제

타원 그리기 관련 문제

를 사용하여 하나의 타원의 일부를 그리려고 했습니다 \pgfpatharcto. 그런데 원래의 완전 타원과 비교를 해보니 약간의 차이가 있습니다. 코드와 결과를 첨부합니다.

\documentclass[tikz]{standalone}
\usepackage{pgfplots}
\begin{document}
\begin{tikzpicture}

\draw (2.5cm,0) ellipse (3.5cm and 3.8436cm);

\pgfsetstrokecolor{red}
\pgfmoveto{\pgfpoint{2.841cm}{3.8284cm}}
\pgfpatharcto{3.5cm}{3.8436cm}{0}{0}{0}{\pgfpoint{2.841cm}{-3.8284cm}}\pgfusepath{stroke};

\end{tikzpicture}
\end{document}

여기에 이미지 설명을 입력하세요

답변1

타원을 두 번 그리는 것도 가능하지만 두 번째는 클리핑 범위 내에 있습니다.

\documentclass[tikz, border=1cm]{standalone}
\usepackage{pgfplots}
\begin{document}
\begin{tikzpicture}

\draw (2.5cm,0) ellipse (3.5cm and 3.8436cm);

\begin{scope}
\clip (2.5cm,0)--++(80:3.9) arc(80:-80:3.9)--cycle;
\draw[red] (2.5cm,0) ellipse (3.5cm and 3.8436cm);
\end{scope}

\end{tikzpicture}
\end{document}

여기에 이미지 설명을 입력하세요

답변2

당신은 시도하고 싶을 수도 있습니다메타포스트이것을하기 위해. subpath저장된 경로의 세그먼트를 그릴 수 있는 유용한 구문이 있습니다 . .lualatex

여기에 이미지 설명을 입력하세요

\RequirePackage{luatex85}
\documentclass[border=5mm]{standalone}
\usepackage{luamplib}
\begin{document}
\mplibtextextlabel{enable}
\begin{mplibcode}
beginfig(1);
    path e;
    e = fullcircle xscaled 3.5cm yscaled 3.8436cm;
    draw e withpen pencircle scaled 2 withcolor .8 white;
    draw subpath (-2,2) of e withcolor 2/3 red;
endfig;
\end{mplibcode}
\end{document}

Metapost는 경로를 따라 "시간"이라는 개념을 제공합니다. 경로에는 fullcircle말하자면 "3시" 지점 0을 시작으로 8개의 시간 지점이 있습니다.

그러니까 subpath (0,2) of c3시부터 정오까지일 거예요. 분수도 사용할 수 있습니다: subpath (2.718, 3.1415) of c.

그리고 내 예에서 볼 수 있듯이 음수를 사용하여 0 지점 "이전" 지점을 참조할 수 있습니다.

관련 정보