jeudi 4 décembre 2014

Tikz: drawing in perspective


I am working on drawing a beam in perspective. I have my point I want to use as the perspective point (10, 3). What would be the way to draw along this line? For instance, consider



\documentclass[tikz]{standalone}
\begin{document}
\begin{tikzpicture}
\draw (0, 0) rectangle (1cm, 1cm);
% I want to draw a 2cm line from (1cm, 0) along the ray that goes to my vanishing point
\end{tikzpicture}
\end{document}



  1. I could set \pgfmathsetmacro\myangle{tan(3/10)} and use the \usetikzlibrary{calc} but \myangle is not producing a line that is 17 degrees when I issue \draw (1cm, 0) -- ++(\myangle:2cm);

  2. I have tried issuing \def\myangle{tan(3/10)} but this doesn't work at all.

  3. Or I could use scope and rotate a the line \draw (1cm, 0) -- (2cm, 0); by the intended angle but again tan(3/10) isn't evaluating correctly (not sure why).





Aucun commentaire:

Enregistrer un commentaire