I found a nice function to draw a nice ellipse between two points. However, I'd like to be able to use this ellipse as a border of a new node, so that if I draw an arrow towards this ellipse, it stops at the border. I tried to look at decoration but it didn't solve my problem...
MWE
\documentclass{report}
\usepackage{tikz}
\usetikzlibrary{arrows,backgrounds,positioning}
\usetikzlibrary{calc,math,fit,shapes}
\usetikzlibrary{decorations.pathmorphing}
\pgfdeclarelayer{bg} % declare background layer
\pgfdeclarelayer{bgmain} % declare background layer
\pgfsetlayers{bg,bgmain,main} % set the order of the layers (main is the standard layer)
\usepackage{xcolor}
\newcommand\ellipsebyfoci[4]{% options, focus pt1, focus pt2, cste
\path[#1] let \p1=(#2), \p2=(#3), \p3=($(\p1)!.5!(\p2)$)
in \pgfextra{
\pgfmathsetmacro{\angle}{atan2(\y2-\y1,\x2-\x1)}
\pgfmathsetmacro{\focal}{veclen(\x2-\x1,\y2-\y1)/2/1cm}
\pgfmathsetmacro{\lentotcm}{\focal*2*#4}
\pgfmathsetmacro{\axeone}{(\lentotcm - 2 * \focal)/2+\focal}
\pgfmathsetmacro{\axetwo}{sqrt((\lentotcm/2)*(\lentotcm/2)-\focal*\focal}
}
(\p3) ellipse[x radius=\axeone cm,y radius=\axetwo cm, rotate=\angle];
}
\begin{document}
\begin{tikzpicture}
\node(a) at (-1,1) {};
\node(b) at (1,-1) {};
\begin{pgfonlayer}{bg}
\ellipsebyfoci{draw,fill=green!50}{a}{b}{1.5}
\end{pgfonlayer}
%% I want to point to the ellipse, not the points
\node[label=east:Should point to the ellipse](c) at (3,-1) {};
\draw[-latex] (c) -- (0,0);
\end{tikzpicture}
\end{document}
Thank you !
-- EDIT 01 --
I found a kind of solution that basically uses the fit
package and the ellipse package. It produces a node, but it's not exactly following the exact ellipse shape of the above function:
\begin{tikzpicture}
\node(a) at (-1,1) {a};
\node(b) at (1,-1) {b};
\node[rotate fit=45,fit=(a)(b),ellipse,fill=red!,opacity=.5](ell){};
\node(x) at (3,2) {};
\draw[->] (x) -- (ell);
\node(y) at (-4,2) {};
\draw[->] (y) -- (ell);
\end{tikzpicture}
And here is the general function for that:
\newcommand\fitEllipse[3]{% options, focus pt1, focus pt2
\pgfmathanglebetweenpoints{\pgfpointanchor{#2}{center}}
{\pgfpointanchor{#3}{center}}
\edef\angle{\pgfmathresult} % save result in \angle
\node[rotate fit=\angle, fit=(#2)(#3),ellipse,#1]{};
}