I'm trying to draw an ellipse on a grid with perspective. If the ellipse is straight (either elongated vertically or horizontally) the below code works. But I'd like to specify a rotation (see second to last line = \ellipse{2,2}{1cm}{2cm}{0})
Code: Select all
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{decorations.pathreplacing,shapes,calc,decorations.markings,patterns}
\begin{document}
\newcommand{\referencePoint}[1]
{
\begin{scope}
\pgftransformcm{1}{0}{0.4}{0.5}{\pgfpoint{0cm}{0cm}}
\filldraw[fill=red, draw=black!50] (#1) circle (.1cm);
\end{scope}
}
\newcommand{\ellipse}[4]
{
\pgftransformcm{1}{0}{0.4}{0.5}{\pgfpoint{0cm}{0cm}}
%here I want to plot an ellipse with radii #2 and #3 at point #1, rotated by #4
\draw [rotate=#4,color=black] (#1) ellipse (#2 and #3);
}
\begin{tikzpicture}
\begin{scope}
\pgftransformcm{1}{0}{0.4}{0.5}{\pgfpoint{0cm}{0cm}}
\draw [black!50,step=1cm] grid (8,8);
\end{scope}
\referencePoint{2,2}
\ellipse{2,2}{1cm}{2cm}{0} %<---- change rotation (0) to say, 30.
\end{tikzpicture}
\end{document}