2

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}

\shade[ball color=blue!25] (0,0,0) circle (2);
\fill[opacity=0.25] (-3,0,4) -- (-1,2,4) -- (5,2,4) -- (3,0,4) -- cycle;

\end{tikzpicture}
\end{center}

\end{document}
user74973
  • 4,071
  • 2
    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. – Huang_d Oct 26 '17 at 16:18
  • If you prefer the axis to point in other directions you can easily change the definitions as shown here. – jakun Oct 27 '17 at 05:41
  • I am interested in drawing the ray from 'N' through 'P' and 'Q'. – user74973 Oct 27 '17 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. – John Kormylo Oct 28 '17 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). – user74973 Oct 29 '17 at 17:46
  • @John Kormylo The y-axis comes out of the paper. Suppose I simply want to draw the line y=2x on the plane z=0. How would that be drawn? Typically, the perspective for such drawings is off the y-axis so that the x-axis and y-axis are not perpendicular to each other. – user74973 Oct 29 '17 at 17:52

1 Answers1

2

This example could be useful to you: http://texample.net/tikz/examples/map-projections/ .

Alex
  • 76
  • Is it too long as a comment? – Display Name Oct 29 '17 at 13:17
  • No, @ArtificialStupidity. I'm still not allowed to comment other people's answers (because I didn't reach 50 yet). But (since I was studying the example from the link I have posted) I thought it could be helpful to answer user7493's question. If this is considered inappropriate by the community, I can delete my answer. – Alex Oct 29 '17 at 13:27
  • @Alex Yes, the code of one of these drawings is what I want. – user74973 Nov 01 '17 at 22:44