How to Find Intersections with Ellipses in PGF/TikZ

Posted by infblnpf on Stack Overflow See other posts from Stack Overflow or by infblnpf
Published on 2010-05-10T08:47:34Z Indexed on 2010/05/10 8:54 UTC
Read the original article Hit count: 394

Filed under:
|
|
|

Hello, I am trying to display a sphere in PGF/TikZ to illustrate the idea of great circles.

The code for my current result is:

\begin{tikzpicture}

\tikzfading[name=fade right,
left color=transparent!20,
right color=transparent!90]

\tikzfading[name=fade out,
inner color=transparent!100,
outer color=transparent!10]

\tikzfading[name=fade right gc,
left color=transparent!0,
right color=transparent!70]

\draw [<->, dashed] (0,-5) -- (0,5); % y-axis
\draw [->, dashed] (0, 0) -- (20:5); % x-axis
\draw [->, dashed] (0, 0) -- (200:5); % x-axis
\draw [->, dashed] (0, 0) -- (340:5); % z-axis
\draw [->, dashed] (0, 0) -- (160:5); % z-axis

\fill [color=cyan, opacity=0.15, path fading=fade out] (0,0) circle (4cm); % bounding circle
\fill [color=cyan, opacity=0.25, path fading=fade right, fading angle=90] (0,0) ellipse (4cm and 1cm); % x-y-axis area

% great circle 1
\draw [rotate=-40, color=red, path fading=fade right gc, fading angle=40] (0,0) ellipse (4cm and 1cm);

% great circle 2
\draw[rotate=5, color=red, path fading=fade right gc, fading angle=5] (0,0) ellipse (1.5cm and 4cm);

\end{tikzpicture}

How do I

  1. find the two points of intersection of the two red ellipses (commented as great circle 1 and 2),
  2. find the point of intersection of a line (originating at the center (0,0)) with a ellipse, and
  3. place a little circle or rectangle there?

Placing a little circle or rectangle there is not an issue. Thank you very much!

© Stack Overflow or respective owner

Related posts about pgf

Related posts about tikz