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}
- I could set
\pgfmathsetmacro\myangle{atan(3/10)}
and use the\usetikzlibrary{calc}
to issue\draw (1cm, 0) -- ++(\myangle:2cm);
I have tried issuing\def\myangle{tan(3/10)}
but this doesn't work at all.- Or I could use
scope
and rotate a the line\draw (1cm, 0) -- (2cm, 0);
by the intended angle.
After fixing tan
to atan
@PeterGrill, I realized there is a problem with drawing to the vanishing point. Only (0, 0)
would be on the line with angle atan(3/10)
. How can make adjustments for the other points? I know I could figure out the math but can LaTeX handle this instead?
Best Answer
May be I misunderstood the question (happens to me lately), but may be you are looking for