# Am I able to intersect curves after rotating?

I would like to intersect arc and sloped line as it's discribed in the code after having rotated the sloped line. Why doesn't the red point belong to sloped line? I hope my question is quite clear for uptake.

\documentclass[12pt,a4paper]{article}
\usepackage{russ}
\usepackage[left=1cm,right=1cm,top=2cm,bottom=2cm]{geometry}
\usepackage{tikz}                   % Для рисования мега-картинок прямо здесь
\usepackage{rotating}
\usetikzlibrary{calc,intersections} % Читайте мануал в Bonus/Books on TeX/Pictures for         TeX/PGF, а также http://www.texample.net/tikz/examples/all/
\colorlet{examplefill}{yellow!80!black}
\begin{document}
\begin{figure}
\begin{tikzpicture}[scale=3]
/cs/horizontal line through={(1,1)}
\path [name path=arc] (0.5cm,0) arc (0:90:0.5cm);
\draw (0,0) ellipse (0.7cm and 2.2cm);
\draw[name path=simple line] (-1,0) -- (1,0) coordinate (x axis);
\draw (0,-2.5) -- (0,2.5) coordinate (y axis);
\begin{turn}{50}
\draw[name path=sloped line] (-2.5,0) -- (2.5,0) coordinate (x axis);
\draw (0,-1.5) -- (0,1.5) coordinate (y axis);
\draw (0,0) ellipse (2cm and 1cm);
\end{turn}
\fill[red,name intersections={of=sloped line and arc, by=s}]
(s) circle (2pt) node[above=3] {a};
\end{tikzpicture}
\centering
\label{elliptic polarization}
\end{figure}
\end{document}


And how to output coordinates of the intersection point instead of a?!

## 1 Answer

To produce the rotation you can use the rotate key inside a scope; then sloped line needs to be a global path name (I added a draw to the arc path just for visualization purposes); using the let syntax you can get the coordinates of the intersection point:

\documentclass[12pt,a4paper]{article}
\usepackage{tikz}
\usepackage{rotating}
\usetikzlibrary{calc,intersections}

\colorlet{examplefill}{yellow!80!black}

\begin{document}

\begin{tikzpicture}[scale=3]
/cs/horizontal line through={(1,1)}
\path[draw,name path=arc]
(0.5cm,0) arc (0:90:0.5cm);
\draw
(0,0) ellipse (0.7cm and 2.2cm);
\draw[name path=simple line]
(-1,0) -- (1,0) coordinate (x axis);
\draw
(0,-2.5) -- (0,2.5) coordinate (y axis);
\begin{scope}[rotate=50]
\draw[name path global=sloped line]
(-2.5,0) -- (2.5,0) coordinate (x axis);
\draw
(0,-1.5) -- (0,1.5) coordinate (y axis);
\draw
(0,0) ellipse (2cm and 1cm);
\end{scope}
\fill[red,name intersections={of=sloped line and arc, by=s}]
let \p1=(s)
in (s) circle (2pt) node[above=5,black] {(\x1,\y1)};
\end{tikzpicture}

\end{document}


The solution above gives the coordinates of the point in pt units; one can have them in the coordinate system units using a variation of the code given by Jake in his answer to Accessing the logic values of a TikZ coordinate:

\documentclass[12pt,a4paper]{article}
\usepackage{tikz}
\usepackage{rotating}
\usetikzlibrary{calc,intersections}

\colorlet{examplefill}{yellow!80!black}

\makeatletter
\newcommand\xcoord[2][center]{{%
\pgfpointanchor{#2}{#1}%
\pgfmathparse{\pgf@x/(\scalefactor*\pgf@xx)}%
\pgfmathprintnumber{\pgfmathresult}%
}}
\newcommand\ycoord[2][center]{{%
\pgfpointanchor{#2}{#1}%
\pgfmathparse{\pgf@y/(\scalefactor*\pgf@xx)}%
\pgfmathprintnumber{\pgfmathresult}%
}}
\makeatother

\pgfkeys{
/pgf/number format/.cd,
fixed,
fixed zerofill,
precision=3
}

\newcommand\labelcoord[2][]{%
\coordinate (aux) at (#2);
\node[#1] at (aux) {(\xcoord{aux},\ycoord{aux})}}

\def\scalefactor{3}

\begin{document}

\begin{tikzpicture}[scale=\scalefactor]
/cs/horizontal line through={(1,1)}
\path[draw,name path=arc]
(0.5cm,0) arc (0:90:0.5cm);
\draw
(0,0) ellipse (0.7cm and 2.2cm);
\draw[name path=simple line]
(-1,0) -- (1,0) coordinate (x axis);
\draw
(0,-2.5) -- (0,2.5) coordinate (y axis);
\begin{scope}[rotate=50]
\draw[name path global=sloped line]
(-2.5,0) -- (2.5,0) coordinate (x axis);
\draw
(0,-1.5) -- (0,1.5) coordinate (y axis);
\draw
(0,0) ellipse (2cm and 1cm);
\end{scope}
\fill[red,name intersections={of=sloped line and arc, by=s}]
(s) circle (2pt);
\labelcoord[above=4pt]{s};
\end{tikzpicture}

\end{document}


• Thx for your solution! It works perfectly! – David Aug 5 '14 at 3:44