tikz add tag
Anonymous 1123
I use *Mathematica* to find  center and radius of  sphere  inscribed  tetrahedron `OABC`, where `O(0,0,0), A(3,0,0), B(0,5,0), C(0,0,14)`. I got center `I(1,1,1)` and radius `r=1`. My code
```
\documentclass[border=2mm,12pt,tikz]{standalone}
\usepackage{tikz-3dplot-circleofsphere}

\begin{document}
	\tdplotsetmaincoords{60}{60}
	\begin{tikzpicture}[scale=1,tdplot_main_coords]
	\path (0,0,0) coordinate (O)
	(3,0,0) coordinate (A)
	(0,5,0) coordinate (B)
	(0,0,14) coordinate (C)
		(1,1,1) coordinate (I);
\begin{scope}[tdplot_screen_coords] 
\fill[ball color=green, opacity=0.8] (I) circle [radius=1];
\end{scope}
	\foreach \p in {A,B,C,O,I}
	\draw[fill=black] (\p) circle (1.5 pt);
	\foreach \p/\g in {A/-90,B/-90,C/90,O/180,I/0}
	\path (\p)+(\g:3mm) node{$\p$};
\draw (C) -- (O) -- (A) -- (B) -- (C) -- (A);
\draw[dashed] (O) -- (B);
	\end{tikzpicture}
	\end{document}
```
![ScreenHunter 806.png](/image?hash=39704792d4aa80241960d710e3d0d68224169d6ac45b656280f08d1622b5f484)
Without using *Mathematica*, how can I use `3dtools` to find  center and radius of a sphere  inscribed a tetrahedron?

Center and radius of sphere can be found like this 
https://math.stackexchange.com/questions/1791289/finding-centre-of-sphere-inscribed-in-tetrahedron
Top Answer
marmot
It is rather easy to do this with [`3dtools`](https://github.com/marmotghost/tikz-3dtools), one only has to follow the prescription in the [answer you link to](https://math.stackexchange.com/a/1791327). The areas can be computed with simple vector products, and the weighted linear combination of vertices is also straightforward. The code tells you that "The center of the inscribed sphere is at (0.99998,0.99998,0.99997) and the radius is 1.00003.", which is consistent with your results modulo rounding errors. 

```
\documentclass[border=2mm,12pt,tikz]{standalone}
\usepackage{tikz-3dplot}
\usetikzlibrary{3dtools}%https://github.com/marmotghost/tikz-3dtools
\begin{document}
\tdplotsetmaincoords{60}{60}
\begin{tikzpicture}[scale=1,tdplot_main_coords]
	\path (0,0,0) coordinate (O)
	(3,0,0) coordinate (A)
	(0,5,0) coordinate (B)
	(0,0,14) coordinate (C);
   \pgfmathsetmacro{\aO}{TD("(A)-(B)x(C)-(B)")}	
   \pgfmathsetmacro{\aO}{sqrt(TD("(\aO)o(\aO)"))/2}	
   \pgfmathsetmacro{\aA}{TD("(B)x(C)")}	
   \pgfmathsetmacro{\aA}{sqrt(TD("(\aA)o(\aA)"))/2}	
   \pgfmathsetmacro{\aB}{TD("(A)x(C)")}	
   \pgfmathsetmacro{\aB}{sqrt(TD("(\aB)o(\aB)"))/2}	
   \pgfmathsetmacro{\aC}{TD("(A)x(B)")}	
   \pgfmathsetmacro{\aC}{sqrt(TD("(\aC)o(\aC)"))/2}	
   \pgfmathsetmacro{\suma}{\aA+\aB+\aC+\aO}
   \pgfmathsetmacro{\aA}{\aA/\suma}
   \pgfmathsetmacro{\aB}{\aB/\suma}
   \pgfmathsetmacro{\aC}{\aC/\suma}
   \pgfmathsetmacro{\aO}{\aO/\suma}
   \pgfmathsetmacro{\vecI}{TD("\aA*(A)+\aB*(B)+\aC*(C)+\aO*(O)")}
   \pgfmathsetmacro{\nABC}{TD("(A)-(B)x(C)-(B)")}
   \pgfmathsetmacro{\normABC}{sqrt(TD("(\nABC)o(\nABC)"))}
   \pgfmathsetmacro{\proj}{TD("(\nABC)o(\vecI)-(B)")/\normABC}
   \path (\vecI) coordinate (I);
   \typeout{The center of the inscribed sphere is at (\vecI) and the radius is
   \proj.}
   \begin{scope}[tdplot_screen_coords] 
   \fill[ball color=green, opacity=0.8] (I) circle [radius=\proj];
   \end{scope}
	\foreach \p in {A,B,C,O,I}
	\draw[fill=black] (\p) circle (1.5 pt);
	\foreach \p/\g in {A/-90,B/-90,C/90,O/180,I/0}
	\path (\p)+(\g:3mm) node{$\p$};
\draw (C) -- (O) -- (A) -- (B) -- (C) -- (A);
\draw[dashed] (O) -- (B);
\end{tikzpicture}
\end{document}
```

![Screen Shot 2020-08-20 at 1.23.39 AM.png](/image?hash=3f4d848ee9c7a7bf36d5f9ddfadbb461bd5b062f6b03681471230cdd45d7f6fe)

Enter question or answer id or url (and optionally further answer ids/urls from the same question) from

Separate each id/url with a space. No need to list your own answers; they will be imported automatically.