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.

I want to rotate point B 30 degrees counterclockwise about A to produce a new point C. However, I failed to get the correct C as illustrated below. The red circle helps us to notice the issue easily.

\documentclass[pstricks,border=12pt]{standalone}
\usepackage{pst-eucl}
\psset{saveNodeCoors}
\begin{document}
\begin{pspicture}[showgrid](6,6)
    \pstGeonode
        (1,1){A}
        (5,3){B}
        (!N-B.y N-A.y sub 2 exp  N-B.x N-A.x sub 2 exp add sqrt N-B.y N-A.y sub N-B.x N-A.x sub atan 30 add PtoC){C}
    \pstCircleOA[linecolor=red]{A}{B}
\end{pspicture}
\end{document}

enter image description here

Notes

Don't suggest me to use \pstRotation as I already know it and it is not my interest. You might suggest me to use ([angle=30,nodesep=]{B}A), but the problem is that nodesep must be assigned with an absolute value. It might be a good idea to add a new key, for example, relnodesep to ([angle=30,...]{B}A) syntax so we can solve this problem by just writing ([angle=30,relnodesep=1]{B}A).

share|improve this question

1 Answer 1

up vote 7 down vote accepted
+150

You only rotate the difference vector between node A and B, but at the end you must add the coordinates of the 'origin' A:

\documentclass[pstricks,border=12pt]{standalone}
\usepackage{pst-eucl}
\psset{saveNodeCoors}
\begin{document}
\begin{pspicture}[showgrid](6,6)
    \pstGeonode
        (1,1){A}
        (5,3){B}
        (!N-B.y N-A.y sub 2 exp  N-B.x N-A.x sub 2 exp add sqrt 
          N-B.y N-A.y sub N-B.x N-A.x sub atan 30 add PtoC 
          N-A.y add exch N-A.x add exch % this was missing
        ){C}
    \pstCircleOA[linecolor=red]{A}{B}
\end{pspicture}
\end{document}

enter image description here

share|improve this answer
    
Oh my ghost, I forgot it. –  Oh my ghost Sep 22 '13 at 14:15

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.