# Drawing a line, a plane, and a sphere, and their points of intersection

The following code renders a sphere and a plane. How do I get the plane to be at the south pole of the sphere - and centered? On this diagram, I would like to draw a ray from the north pole N through the point P = (-\sqrt{3}, -1/\sqrt{2},-1/\sqrt{2}) and through the point Q = ((-\sqrt{3}/7)(-8+2\sqrt{2}), (-\sqrt{2}/14)(-8+2\sqrt{2}), -2) of intersection between the ray and the plane, and I would like to mark N, P, and Q with a dot. (I want to keep the code in a TikZ environment.)

\documentclass{amsart}

\usepackage{mathtools,array}

\usepackage{tikz}
\usetikzlibrary{calc,intersections}

\begin{document}

\begin{center}
\begin{tikzpicture}

\fill[opacity=0.25] (-3,0,4) -- (-1,2,4) -- (5,2,4) -- (3,0,4) -- cycle;

\end{tikzpicture}
\end{center}

\end{document}

• Tikz uses a painter's algorithm for drawing, what is written (in code) first is drawn first and code afterwards is drawn on top. For positioning, x and y are on the paper, z goes into the paper; so you have to re-order your coordinates to make it work. So (0,-2,0) would be the south pole of your sphere; (-2,-2,-2) the left front corner. This code: \fill[opacity=0.25] (-2,-2,-2) -- (2,-2,-2) -- (2,-2,2) -- (-2,-2,2) -- cycle; \shade[ball color=blue!25] (0,0,0) circle (2); should get you going. Oct 26, 2017 at 16:18
• If you prefer the axis to point in other directions you can easily change the definitions as shown here. Oct 27, 2017 at 5:41
• I am interested in drawing the ray from 'N' through 'P' and 'Q'. Oct 27, 2017 at 11:07
• If you look in the pgfmath section of the tikz manual, you will see that it use sqrt(3) instead of \sqrt{3}. Other than that, it should work for \coordinate or \fill[black] circle(2pt) node[above right]{P}; etc. Oct 28, 2017 at 14:40
• @John Kormylo I was stating the ray that I wanted using TeX commands. I know that to code in TikZ, the coordinates would be specified with commands like sqrt(3) and -1/sqrt(2). Oct 29, 2017 at 17:46