7

I am trying to draw Heronian Tetrahedron at http://mathworld.wolfram.com/HeronianTetrahedron.html. I cannot get the exact results with the message "Dimension too large" of the point S. How can I get the correct result?

\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}

enter image description here

Bernard
  • 271,350

3 Answers3

8

The fix is very simple. TeX is complaining about the fraction 17384/225 and didn't like the numerator. All I did was to replace this fraction by 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}

enter image description here

4

This code get correct result and doesn't get message "Dimension too large".

\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}
2

I use this code and get correct result.

\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} 

enter image description here