Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

How can I make an animation of line y=-3 that rotates by angle $\phi$ and the perpendicular distance from origin to this line. I also need to trace the shape that points of the intersection of the line with the perpendicular line makes.

Sorry, I forgot to mention that I also need a coordinate axes.

share|improve this question

1 Answer 1

up vote 10 down vote accepted
\documentclass[border=10pt,pstricks]{standalone}
\usepackage{pst-node,pst-plot,pst-eucl,multido}

\begin{document}
\multido{\iA=0+6,\iB=1+1}{60}{%
\begin{pspicture}(-5.2,-5.2)(5.5,2.5)
    \pnode(0,0){O}
    \psaxes[linewidth=0.5pt]{->}(0,0)(-5,-5)(5,2)[$x$,0][$y$,90]
    \rput{\iA}(0,-3){\pnodes(-4,0){A}(4,0){B}\psline(A)(B)}
    \pnode(!\iA\space tan dup 0 eq { -3 0 }{1 exch div neg 5 mul 5} ifelse exch){C}
    \pstInterLL{A}{B}{O}{C}{D}
    \pnode(0,0){Aa}
    \multido{\iC=0+6}{\iB}{%
      \rput{\iC}(0,-3){\pnodes(-4,0){Ab}(4,0){Bb}}%
      \pnode(!\iC\space tan dup 0 eq { -3 0 }{1 exch div neg 5 mul 5} ifelse exch){Cb}%
      \pstInterLL[PointSymbol=none,PointName=none]{Ab}{Bb}{O}{Cb}{Db}%
      \psline(Aa)(Db)\pnode(Db){Aa}}%
    \psline[linestyle=dashed](0,0)(D)
\end{pspicture}%
}
\end{document}

Converted into a gif with:

convert -delay 50 -loop 0 -density 200 -scale 350 -alpha remove test.pdf test.gif

enter image description here

share|improve this answer
    
I also need a coordinate axis. –  Student Mar 25 at 13:40
    
see edited answer –  Herbert Mar 25 at 13:52
    
This is line y=0, can you please change it to y=-3. and there is no perpendicular line from origin to the line in your solution. –  Student Mar 25 at 13:58
    
@Student: Which is the rotation point of the line? –  Herbert Mar 25 at 14:12
    
line y=-3, and the rotation point is (0,-3). Thanks. –  Student Mar 25 at 14:14

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.