我该如何修复此代码中点 S 的尺寸过大?

我该如何修复此代码中点 S 的尺寸过大?

我正在尝试绘制 Heronian Tetrahedronhttp://mathworld.wolfram.com/HeronianTetrahedron.html。我无法获得准确的结果,并且点的消息为“尺寸太大” S。我该如何获得正确的结果?

\documentclass[tikz,border=2 mm,12pt]{standalone}
\usepackage{tikz-3dplot-circleofsphere}
\begin{document} 
\tdplotsetmaincoords{75}{150} 
    \begin{tikzpicture}[scale=1/10,line cap=butt,line join=round,tdplot_main_coords,declare function={R= 17*sqrt(7801)*(1/18);r=689/10;
        Angle=acos(r/R);%
    }] 
\path 
    coordinate (A) at (-117/2, 182/5, 2116/45) 
    coordinate (B) at (117/2, 182/5, 2116/45) 
    coordinate (C) at (399/26, 4366/65, 2116/45)
    coordinate (S) at (495/26, 8134/325, 17384/225)
    coordinate (O) at   (0,0,0)
    coordinate (T)  at (0,0, 2116/45) 
    coordinate (D) at (-117/2, -182/5, 2116/45); 
    \begin{scope}[tdplot_screen_coords]
\draw[thick] (O) circle (R);
\end{scope}
\begin{scope}
\tdplotCsDrawLatCircle[tdplotCsFront/.style={thick}]{R}{{Angle}}
\tdplotCsDrawLonCircle[tdplotCsFront/.style={thick}]{R}{atan(-45/28)}
\end{scope}
\foreach \p in {A,B,C,S,O,T,D}
\draw[fill=black] (\p) circle (15 pt);
\foreach \p/\g in {A/-90,B/45,C/-90,S/150,O/90,T/0,D/60}
\path (\p)+(\g:30mm) node{$\p$};
\foreach \X in {A,B,C} \draw[dashed] (\X) -- (S); 
\draw[dashed] (A) -- (B) -- (C) --  cycle (A) -- (C) ;
\end{tikzpicture} 
\end{document}

在此处输入图片描述

答案1

修复方法很简单。TeX 抱怨分数17384/225,不喜欢分子。我所做的就是用 替换这个分数173.84/2.25

\documentclass[tikz,border=2 mm,12pt]{standalone}
\usepackage{tikz-3dplot-circleofsphere}
\begin{document} 
\tdplotsetmaincoords{75}{150} 
    \begin{tikzpicture}[scale=1/10,line cap=butt,line join=round,tdplot_main_coords,declare function={R= 17*sqrt(7801)*(1/18);r=689/10;
        Angle=acos(r/R);%
    }] 
\path 
    coordinate (A) at (-117/2, 182/5, 2116/45) 
    coordinate (B) at (117/2, 182/5, 2116/45) 
    coordinate (C) at (399/26, 4366/65, 2116/45)
    coordinate (S) at (495/26, 8134/325, 173.84/2.25)
    coordinate (O) at   (0,0,0)
    coordinate (T)  at (0,0, 2116/45) 
    coordinate (D) at (-117/2, -182/5, 2116/45); 
    \begin{scope}[tdplot_screen_coords]
\draw[thick] (O) circle (R);
\end{scope}
\begin{scope}
\tdplotCsDrawLatCircle[tdplotCsFront/.style={thick}]{R}{{Angle}}
\tdplotCsDrawLonCircle[tdplotCsFront/.style={thick}]{R}{atan(-45/28)}
\end{scope}
\foreach \p in {A,B,C,S,O,T,D}
\draw[fill=black] (\p) circle (15 pt);
\foreach \p/\g in {A/-90,B/45,C/-90,S/150,O/90,T/0,D/60}
\path (\p)+(\g:30mm) node{$\p$};
\foreach \X in {A,B,C} \draw[dashed] (\X) -- (S); 
\draw[dashed] (A) -- (B) -- (C) --  cycle (A) -- (C) ;
\end{tikzpicture} 
\end{document}

在此处输入图片描述

答案2

此代码获得正确结果并且没有出现“尺寸太大”消息。

\documentclass[tikz,border=2 mm,12pt]{standalone}
\usepackage{fouriernc}
\usepackage{tikz-3dplot-circleofsphere}
\begin{document} 
\tdplotsetmaincoords{75}{170} 
\begin{tikzpicture}[scale=1/10,line cap=butt,line join=round,tdplot_main_coords,declare function={R= 17*sqrt(7801)*(1/18);r=689/10;
    Angle=acos(r/R);%
}] 
\path 
coordinate (A) at (0, 0, 0) 
coordinate (B) at (117, 0, 0) 
coordinate (C) at (960/13, 400/13, 0)
coordinate (S) at (1008/13, -3696/325, 756/25)
coordinate (O) at   (117/2, -182/5, -2116/45)
coordinate (T)  at (117/2, -182/5,0) ; 
\begin{scope}[tdplot_screen_coords]
\draw[thick] (O) circle (R);
\end{scope}
\begin{scope}[shift={(O)}]
\tdplotCsDrawLatCircle[tdplotCsFront/.style={thick}]{R}{{Angle}}
\end{scope}
\foreach \p in {A,B,C,S,O,T}
\draw[fill=black] (\p) circle (15 pt);
\foreach \p/\g in {A/-90,B/-90,C/-90,S/150,O/90,T/0}
\path (\p)+(\g:30mm) node{$\p$};
\foreach \X in {A,B,C} \draw[dashed] (\X) -- (S); 
\draw[dashed] (A) -- (B) -- (C) --  cycle (A) -- (C) ;
\end{tikzpicture} 
\end{document}

答案3

我使用此代码并得到正确的结果。

\documentclass[border=3.14]{standalone}
\usepackage{tikz,tikz-3dplot}
\usetikzlibrary{fpu}
\def\pgfmathsetmacroFPU#1#2{\begingroup%
    \pgfkeys{/pgf/fpu,/pgf/fpu/output format=fixed}%
    \pgfmathsetmacro{#1}{#2}%
    \pgfmathsmuggle#1\endgroup}%
\begin{document}

        \tdplotsetmaincoords{80}{70}
        \begin{tikzpicture}[tdplot_main_coords,line cap=butt,line join=round,c/.style={circle,fill,inner sep=1pt},
            declare function={a=51;b=52;c=53;m=80;n=84;p=117;}]
            \begin{scope}[/pgf/fpu,/pgf/fpu/output format=fixed]
                \path (0,0,0) coordinate (A)
                (c,0,0) coordinate (B)
                ({(pow(b,2) + pow(c,2) - pow(a,2))/(2*c)},{sqrt((a+b-c) *(a-b+c) *(-a+b+c)* (a+b+c))/(2*c)},0) coordinate (C)
                ({c/2},{(c* (a^2 + b^2 - c^2))/(2* sqrt((a + b - c) *(a - b + c)* (-a + b + c)* (a + b + c)))},0)   coordinate  (G)
                ({(c^2 + m^2 - n^2)/(2*c)},{(-c^4 + (a^2 + b^2 + m^2 + n^2 - 2*p^2)*c^2 + (m - n)*(m + n)*(a - b)*(a + b))/(2*sqrt(-(a + b - c)*(a - b + c)*(a - b - c)*(a + b + c))*c)},{-1*sqrt((a - b + c)*(a - b - c)*(a + b + c)*(b^2*n^4 + ((a^2 - b^2 - c^2)*p^2 + (-b^2 + m^2)*c^2 + b^4 + (-a^2 - m^2)*b^2 - a^2*m^2)*n^2 + c^2*p^4 + (c^4 + (-a^2 - b^2 - m^2)*c^2 - a^2*m^2 + b^2*m^2)*p^2 + ((b^2 - m^2)*c^2 + m^2*(a^2 - b^2 + m^2))*a^2)*(a + b - c))/(a^4 - 2*a^2*b^2 - 2*a^2*c^2 + b^4 - 2*b^2*c^2 + c^4)})  coordinate (S)
                ( {c/2},{c*(a^2 + b^2 - c^2)/(2*sqrt(-(a + b - c)*(a - b + c)*(a - b - c)*(a + b + c)))},{-1*(a^4*m^2 + 2*a^2*b^2*c^2 - a^2*b^2*m^2 - a^2*b^2*n^2 - a^2*c^2*m^2 - a^2*c^2*p^2 + b^4*n^2 - b^2*c^2*n^2 - b^2*c^2*p^2 + c^4*p^2)/(2*sqrt((a^4 - 2*a^2*b^2 - 2*a^2*c^2 + b^4 - 2*b^2*c^2 + c^4)*(a^4*m^2 + a^2*b^2*c^2 - a^2*b^2*m^2 - a^2*b^2*n^2 - a^2*c^2*m^2 - a^2*c^2*p^2 + a^2*m^4 - a^2*m^2*n^2 - a^2*m^2*p^2 + a^2*n^2*p^2 + b^4*n^2 - b^2*c^2*n^2 - b^2*c^2*p^2 - b^2*m^2*n^2 + b^2*m^2*p^2 + b^2*n^4 - b^2*n^2*p^2 + c^4*p^2 + c^2*m^2*n^2 - c^2*m^2*p^2 - c^2*n^2*p^2 + c^2*p^4)))})coordinate (T);
                \pgfmathsetmacroFPU{\myr}{a*b*c/sqrt((b+c-a)* (a + b - c) *(a - b + c)* (a + b + c))}
                \pgfmathsetmacroFPU{\myR}{sqrt((a^4*m^4 - 2*m^2*(b^2*n^2 + c^2*p^2)*a^2 + b^4*n^4 - 2*b^2*c^2*n^2*p^2 + c^4*p^4)/(a^4*m^2 + ((c^2 - m^2 - n^2)*b^2 + (-m^2 - p^2)*c^2 + m^4 + (-n^2 - p^2)*m^2 + n^2*p^2)*a^2 + b^4*n^2 + ((-n^2 - p^2)*c^2 + (-n^2 + p^2)*m^2 + n^4 - n^2*p^2)*b^2 + c^2*(p^2*c^2 + (n^2 - p^2)*m^2 - n^2*p^2 + p^4)))/2}
                \draw[thick, red, tdplot_screen_coords] (T) circle [radius = \myR]; 
                \draw [dashed] (A) -- (C) (S) -- (A) (S) -- (B) (S) -- (C) (A) -- (B) -- (C);
                
                \draw[thick, blue] (G) circle [radius = \myr];  
            \end{scope}
            
            %\path foreach \p/\g in {A/-90,B/-90,C/-90,S/90,G/-90,T/0}{(\p)node[c]{}+(\g:2.5mm) node{$\p$}};
        \end{tikzpicture}
    \end{document} 

在此处输入图片描述

相关内容