[Tex/LaTex] How to draw a 3D, three-sided 5-7-9 triangle with TikZ or PSTricks

pstrickstikz-pgf

I want to draw a triangle with three sides 5, 7, 9 and its incircle in geometry 3D. I used GeospacW. I tried

  • Draw a circle (T) has center origin and has radius r=15/sqrt(11).
  • Take a point A on (T) and draw a circle (C1) has center A and has radius r=5.
  • Find the intersection of points between (T) and (C1), say one of them is B.
  • Draw a circle (C2) has center B and has radius 7.
  • Find the intersection of points between (T) and (C2), say one of them is C.
  • Draw the triangle ABC and its incircle.

enter image description here

After drawing the triangle, I draw a pyramid DABC with DC perpendicular to the plane (ABC) and DC=\sqrt{33}/2.

enter image description here

Best Answer

I use Mathematica to find coordinates of the points A, B, C, I and radius of the incircle.

\documentclass[border=2mm,12pt,tikz]{standalone}
\usepackage{tikz-3dplot} 
\begin{document}
    \tdplotsetmaincoords{60}{60}
    \begin{tikzpicture}[tdplot_main_coords]
\path (0,0,0) coordinate (A)
     (9, 0,0) coordinate (B) 
    (35/6, {7*sqrt(11)/6},0) coordinate (C)
    (35/6, {7*sqrt(11)/6},{sqrt(33)/2}) coordinate (D)
        (11/2, {sqrt(11)/2},0) coordinate (I);
    \draw[blue,dashed] (I) circle[radius= {sqrt(11)/2}];    
\foreach \p in {A,B,C,D,I}
\draw[fill=black] (\p) circle (1.5pt);
\foreach \p/\g in {A/180,C/0,B/-90,D/90,I/0}
\path (\p)+(\g:3mm) node{$\p$};
\foreach \X in {A,B,C} \draw[thick] (\X) -- (D);
\draw[thick] (A) -- (B) -- (C) ;
\draw[dashed] (A)-- (C) ;
\end{tikzpicture}
\end{document}

enter image description here

With this code, you can change values of three numbers a, b, c enough large. E.g, I used a=7;b=8;c=10.

\documentclass[12pt, border = 1mm]{standalone}
\usepackage{tikz}
\usepackage{tikz-3dplot}
\begin{document}
    \tdplotsetmaincoords{60}{60}
    \begin{tikzpicture}[tdplot_main_coords,scale=1,tdplot_main_coords,declare function={a=7;b=8;c=10;h=sqrt(33)/2;R= 1/2*sqrt((a + b - c)* (a - b + c) *(-a + b + c)/(a + b + c));%
    }]
\coordinate (A) at (0,0,0);
\coordinate (B) at (c,0,0);
\coordinate (C) at  ({(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 (D) at ({(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)},h);
 \coordinate (I) at ({1/2 *(-a + b + c)}, 
 { 1/2*sqrt(((a + b - c)* (a - b + c)* (-a + b + c))/(a + b + c))});
    \draw[red,dashed,thick] (I) circle[radius= R];  
\foreach \p in {A,B,C,D,I}
\draw[fill=black] (\p) circle (1.5pt);
\foreach \p/\g in {A/180,C/0,B/-90,D/90,I/0}
\path (\p)+(\g:3mm) node{$\p$};
\foreach \X in {A,B,C} \draw[thick] (\X) -- (D);
\draw[thick] (A) -- (B) -- (C) ;
\draw[dashed] (A)-- (C) ;
\end{tikzpicture}
\end{document}

enter image description here