I want to construct triangle with three sides `3, 5, 7` in the `xy` plane. My code ``` \documentclass[border=2mm,tikz]{standalone} \usepackage{tikz-3dplot} \usetikzlibrary{intersections} \begin{document} \tdplotsetmaincoords{60}{150} \begin{tikzpicture}[scale=1,tdplot_main_coords,line join = round, line cap = round, declare function={R=5;}] \path (0,0,0) coordinate (B) (0, 7, 0) coordinate (C) ; \begin{scope}[canvas is xy plane at z=0] \draw[name path=cB] (B) circle[radius=3]; \draw[name path=cC] (C) circle[radius=5]; \path [name intersections={of=cB and cC}]; \coordinate (A) at (intersection-1); \path [name intersections={of=cB and cC}]; \coordinate (D) at (intersection-2); \end{scope} \path foreach \p/\g in {B/90,C/90,A/60,D/90} { (\p) node[circle,fill,inner sep=1pt,label=\g:{{$\p$}}]{}}; \draw (A) -- (B) --(C) --cycle (C) -- (B) --(D) --cycle ; \end{tikzpicture} \end{document} ```  If the plane is not `xy` plane, How to find intersection point of two circles in any plane? **UPDATE** Find intersection of two circles `(ABC)` and `(ABD)` where ``` (-4, 2, 3) coordinate (A) (1, -2, 6) coordinate (B) (1, 5, 7) coordinate (C) (5,2,6) coordinate (D) ``` This picture is drawn with Geosplan - Geospacw [here](http://www.aid-creem.org/)  I copied this code from comment ``` \documentclass[border=2mm,tikz]{standalone} \usepackage{tikz-3dplot} \usetikzlibrary{3dtools,intersections} \begin{document} \tdplotsetmaincoords{60}{150} \begin{tikzpicture}[scale=1,tdplot_main_coords,line join = round, line cap = round, declare function={R=5;}] \path (1,2,3) coordinate (I) (-4, 2, 3) coordinate (A) (1, -2, 6) coordinate (B) (1, 5, 7) coordinate (C) (5,2,6) coordinate (D) ; \path[every path/.append style={name path global=c1}] pic{3d circle through 3 points={% A={(A)},B={(B)},C={(C)},center name=H}}; \path[every path/.append style={name path global=c2}] pic{3d circle through 3 points={% A={(A)},B={(B)},C={(D)},center name= K}}; %\path [name intersections={of=c1 and c2}]; \begin{scope}[shift={(I)}] \draw[tdplot_screen_coords] (I) circle[radius=R]; \end{scope} \path[name intersections={of=c1 and c2,total=\t}] %\pgfextra{\typeout{\t}} foreach \X in {1,...,\t} {(intersection-\X) node[circle,draw,inner sep=1ex,label=above:$\X$]{}}; \path foreach \p/\g in {I/0,A/90,B/90,C/90,D/90} { (\p) node[circle,fill,inner sep=1pt,label=\g:{{$\p$}}]{}}; \end{tikzpicture} \end{document} ``` I got incorrect result 
Here is one possible way to answer the question. We are given two points, `A` and `B`, which are the centers of the circles or radii `r1` and `r2`, respectively. A third point `C` which is not collinear with `A--B` defines a plane in three dimensions going through `A`, `B` and `C`. Then there are four cases: 1. The distance `d` between `A` and `B` is larger than the sum of the two radii, i.e. `d>r1+r2`, or `r1>r2+d` or `r2>r1+d`, in which case there is no intersection. 2. `r1+r2=d`, in which case there is a unique intersection. 3. `r1+r2>d` but neither `r1>r2+d` nor `r2>r1+d`. Then there are two intersections. These cases are covered by the following code. ``` \documentclass[border=2mm,tikz]{standalone} \usepackage{tikz-3dplot}% https://github.com/marmotghost/tikz-3dtools \usetikzlibrary{3dtools} \begin{document} \tdplotsetmaincoords{60}{150} \begin{tikzpicture}[scale=1,tdplot_main_coords,line join = round, line cap = round, declare function={r1=5;r2=4;}, declare function={cosinelaw(\a,\b,\c)=acos((\a*\a+\b*\b-\c*\c)/(2*\a*\b));}] \path (1,2,3) coordinate (A) (4,5,6) coordinate (B) (2,1,-3) coordinate (C); % distance \pgfmathsetmacro{\myd}{sqrt(TD("(A)-(B)o(A)-(B)"))} \ifdim\myd pt<0.2pt\relax \typeout{The two center points are too close to each other.} \else \pgfmathtruncatemacro{\itest}{(\myd+r1<r2?0:1)*(\myd+r2<r1?0:1)*(sign(r1+r2-\myd)+1)} \ifcase\itest \typeout{The circles do not intersect.} \or \typeout{There is one unique intersection.} \pgfmathsetmacro{\myr}{r1/\myd} \path[3d coordinate={(I)=(A)-\myr*(A)+\myr*(B)}]; \or \pgfmathsetmacro{\myn}{TD("(A)-(B)x(A)-(C)")} \pgfmathsetmacro{\myn}{sqrt(TD("(\myn)o(\myn)"))} \ifdim\myn pt<0.1pt\relax \typeout{The three points defining the plane are too collinear.} \else \pgfmathsetmacro{\mynx}{1/\myd} \pgfmathsetmacro{\myex}{TD("\mynx*(A)-\mynx*(B)")} \pgfmathsetmacro{\myn}{TD("(A)-(B)x(A)-(C)")} \pgfmathsetmacro{\myey}{TD("(\myex)x(\myn)")} \pgfmathsetmacro{\myny}{1/sqrt(TD("(\myey)o(\myey)"))} \pgfmathsetmacro{\myey}{TD("\myny*(\myey)")} \pgfmathsetmacro{\myalpha}{cosinelaw(r1,\myd,r2)} \pgfmathsetmacro{\mya}{-r1*cos(\myalpha)} \pgfmathsetmacro{\myb}{r1*sin(\myalpha)} \path[3d coordinate={(I_1)=(A)+\mya*(\myex)+\myb*(\myey)}, 3d coordinate={(I_2)=(A)+\mya*(\myex)-\myb*(\myey)}]; \pgfmathsetmacro{\tsta}{sqrt(TD("(B)-(I_1)o(B)-(I_1)"))} \pgfmathsetmacro{\tstb}{sqrt(TD("(B)-(I_2)o(B)-(I_2)"))} \path[overlay] (\myex) coordinate (ex) (\myey) coordinate (ey); \begin{scope}[x={(ex)},y={(ey)}] \draw (A) circle[radius=r1]; \draw (B) circle[radius=r2]; \end{scope} \path foreach \X in {A,B,C,I_1,I_2} {(\X) node[circle,inner sep=1pt,fill,label=above:{$% \pgfmathparse{TD("(\X)")}% \X=(\pgfmathprintvector\pgfmathresult)$}]{}}; \fi \fi \fi \end{tikzpicture} \end{document} ``` 