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

  • If you pre-compute all the coordinates in (x,y,z), drawing it in 3D is easy. If you want to use geometric construction, it is hard enough in 2D. In particular, the Tikz through library uses 2D coordinates. Mar 30, 2014 at 5:04
  • In TikZ, we can define a coordinate with x and y parts as in (0,0) as well as with x, y and z parts as in (0,0,0). I even tried (0,0,0,0) but it cannot be used for actual drawing, I suppose, but there is no error message if used and it works in general \coordinate (A) at (0,0,0,0); \coordinate (B) at (0,0,0,2); \draw (A)--(B) node {Hello World!};. To be honest, I have never been in need of the fourth dimension in TikZ... :-)
    – Malipivo
    Mar 30, 2014 at 6:43

3 Answers 3


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

\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) ;

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

enter image description here


One can pre-compute the coordinates using


or one can use Tikz and \whereami to get the coordinates




\newlength{\whereamix} \newlength{\whereamiy}
\newcommand{\whereami}[2]{  % #1 = anchor name, #2 = color
 \draw[color=#2] (#1) node{
  (\strip@pt\whereamix, \strip@pt\whereamiy)

%construct 5-7-9 triangle ABC
\coordinate (A) at (0,0);
\coordinate (B) at (9,0);
\draw[lightgray,name path=AB] (A) -- (B);
\draw[lightgray,name path=AC] (A) circle(5);
\draw[lightgray,name path=BC] (B) circle(7);
\path [name intersections={of=AC and BC}];
\coordinate (C) at (intersection-1);
\draw[blue] (A) -- (B) -- (C) -- cycle;
%bisect angle CAB
\path [name intersections={of=AB and AC}];
\coordinate (C1) at (intersection-1);
\draw[lightgray,name path=CEF] (C) circle(4);
\draw[lightgray,name path=C1E] (C1) circle(4);
\path [name intersections={of=CEF and C1E}];
\coordinate (E) at (intersection-2);
%bisect angle CBA
\path [name intersections={of=AB and BC}];
\coordinate (C2) at (intersection-1);
\draw[lightgray,name path=C2F] (C2) circle(4);
\path [name intersections={of=CEF and C2F}];
\coordinate (F) at (intersection-1);
%locate incenter
\draw[lightgray,name path=AE] (A) -- (E);
\draw[lightgray,name path=BF] (B) -- (F);
\path [name intersections={of=AE and BF}];
\coordinate (D) at (intersection-1);
%construct inscribed circle
\draw[lightgray,name path=DG] (D) -- +(0,-4);
\path [name intersections={of=AB and DG}];
\coordinate (G) at (intersection-1);
%print coordinates

However you do it, once you have the coordinates you can easily draw the diagram.

3d picture


%define xyz coordinate system
%pre-computed coordinates
\coordinate (A) at (0,0,0);
\coordinate (C) at (9,0,0);
\coordinate (B) at (3.17,3.88,0);
\coordinate (I) at (3.51,1.66,0);
\coordinate (D) at (9,0,2.87);
%start drawing
\path (A) node[left]{$A$}
 (B) node[below]{$B$}
 (C) node[right]{$C$}
 (D) node[above]{$D$}
 (I) node[left]{$I$};
\draw[red] (A) -- (B) -- (C) -- (D) -- cycle  (B) -- (D);
\draw[red,dashed] (A) -- (C);
\draw[blue] (I) circle(1.66);
\fill[black] (A) circle(2pt) 
 (B) circle(2pt)
 (C) circle(2pt)
 (D) circle(2pt)
 (I) circle(2pt);
  • Where do the magic numbers 0.0352 in the \wherami come from? Won't those need to be adjusted if one changes the x and y vectors? Apr 8, 2014 at 3:39
  • @Peter Grill - Conversion from pt to cm. cm is sort of the default unit for Tikz. Apr 8, 2014 at 3:44

the triangle:


\pstGeonode(0,0){O}(!15 11 sqrt div 45 PtoC){A}
\pscircle[linecolor=red](O){!15 11 sqrt div}


enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .