如何在 LaTeX 中绘制此图形?

如何在 LaTeX 中绘制此图形?

我正在使用 Geogebra。当我导出到 LaTeX 时,Geogebra 不支持 3D 形状,只支持 2D 形状。我需要有人向我解释如何在 LaTeX 中绘制此形状。

在此处输入图片描述

答案1

将来,请提供一些您尝试过的代码,并明确提出您遇到的抽象问题。

这是绘制您所展示内容的建议。它不太可靠,因为如果您想更改黑色圆圈的位置和半径,则需要您手动更改大量坐标。

\documentclass{standalone}

\usepackage{tikz}
    \usetikzlibrary{3d}
    \usetikzlibrary{through}
    \usetikzlibrary{arrows.meta}

\begin{document}

\begin{tikzpicture}

    \begin{scope}[canvas is xz plane at y = 0]
        \draw[orange] (0, 0) circle (1cm);
    \end{scope}
    
    \draw[densely dotted, red] (0, 0, -.8) -- (1, 0, -.8) -- (1, 0, 0);
        
    \begin{scope}[%
        plane x = {({sqrt(1/1.64)}, 0, -{.8*sqrt(1/1.64)})},
        plane y = {(0, 1, 0)},
        canvas is plane,
    ]
        
        \coordinate (A) at ({sqrt(1.64)}, 0.3);
        \draw[densely dotted, red] (sqrt{1.64}, 0) -- (A);
        \draw (1, 0) -- (A);
        \node[draw, circle through = (A)] at (1, 0) {};
        
    \end{scope}
    
    \draw[red, -Latex] (-2, 0, 0) -- (2, 0, 0);
    \draw[blue, -Latex] (0, -2, 0) -- (0, 2, 0);
    \draw[green, -Latex] (0, 0, 2) -- (0, 0, -2);
    
    \fill[black] (1, 0, 0) circle (.02cm)
                 (0, 0, -.8) circle (.02cm)
                 (1, 0, -.8) circle (.02cm)
                 ({sqrt(1/1.64)}, 0, -{.8*sqrt(1/1.64)}) circle (.02cm);

\end{tikzpicture}

\end{document}

得出的结果是:

在此处输入图片描述

编辑

如上所述,建议的代码对圆心坐标的变化不具有鲁棒性。然后,以下代码允许用户选择圆心和它经过的点的高度。

\documentclass{standalone}

\usepackage{tikz}
    \usetikzlibrary{3d}
    \usetikzlibrary{through}
    \usetikzlibrary{calc}
    \usetikzlibrary{arrows.meta}

\begin{document}

\tikzset{%
    pics/myCircle/.style n args = {3}{%
        code = {%
            \pgfmathsetmacro{\orientation}{ifthenelse(#2 <= 0, -1, 1)}      
        
            \draw[densely dotted, red] (0, 0, #2) -- (#1, 0, #2) -- (#1, 0, 0); 
            \begin{scope}[%
                plane x = {({\orientation*(#1/#2)*sqrt(1/(1 + (#1*#1)/(#2*#2)))}, 0, {\orientation*sqrt(1/(1 + (#1*#1)/(#2*#2)))})},
                plane y = {(0, 1, 0)},
                canvas is plane,
            ]
                \coordinate (A) at ({sqrt(#1*#1 + #2*#2)}, #3);
                \draw[densely dotted, red] ({sqrt(#1*#1 + #2*#2)}, 0) -- (A);
                \draw (1, 0) -- (A);
                \node[draw, circle through = (A)] at (1, 0) {}; 
            \end{scope}
            
            \fill[black] (#1, 0, 0) circle (.02cm)
                         (0, 0, #2) circle (.02cm)
                         (#1, 0, #2) circle (.02cm)
                         ({\orientation*(#1/#2)*sqrt(1/(1 + (#1*#1)/(#2*#2)))}, 0, {\orientation*sqrt(1/(1 + (#1*#1)/(#2*#2)))}) circle (.02cm);
        },
    },%
}

\begin{tikzpicture}

    \begin{scope}[canvas is xz plane at y = 0]
        \draw[orange] (0, 0) circle (1cm);
    \end{scope}
        
    \draw[red, -Latex] (-2, 0, 0) -- (2, 0, 0);
    \draw[blue, -Latex] (0, -2, 0) -- (0, 2, 0);
    \draw[green, -Latex] (0, 0, 2) -- (0, 0, -2);
    
    \draw pic {myCircle = {1}{-.8}{.3}};

\end{tikzpicture}

\end{document}

相关内容