# How to cancel the effect of \translate when I want to draw a radial line from the untranslated origin to the current point?

Consider the following MWE first.

\documentclass[pstricks,border=12pt]{standalone}
\SpecialCoor
\usepackage{multido}
\begin{document}

% draw the tangential lines
\begin{pspicture}[showgrid](-5,-5)(5,5)
\pscustom[linecolor=red]
{
\psline(1,0)
\code{0 /Angle ED}
\multido{\i=1+1}{15}
{
\translate(!!CP)
\lineto(!1 Angle 1 \i\space 1 sub sqrt Atan add dup /Angle ED PtoC)
}
}
\end{pspicture}

\begin{pspicture}[showgrid](-5,-5)(5,5)
\pscustom[linecolor=blue]
{
\psline(1,0)
\code{0 /Angle ED}
\multido{\i=1+1}{15}
{
\translate(!!CP)
\moveto(!1 Angle 1 \i\space 1 sub sqrt Atan add dup /Angle ED PtoC)
\psline[liftpen=2](0,0)(!!CP)% draw from the UNTRANSLATED origin to the current point
}
}
\end{pspicture}

\end{document}


It produces two output as follows.

## Objective

The red curve is made by concatenating unit tangent vectors

\pscustom[linecolor=red]
{
\psline(1,0)
\code{0 /Angle ED}
\multido{\i=1+1}{15}
{
\translate(!!CP)
\lineto(!1 Angle 1 \i\space 1 sub sqrt Atan add dup /Angle ED PtoC)
}
}


and the blue curve is not what I want to get.

\pscustom[linecolor=blue]
{
\psline(1,0)
\code{0 /Angle ED}
\multido{\i=1+1}{15}
{
\translate(!!CP)
\moveto(!1 Angle 1 \i\space 1 sub sqrt Atan add dup /Angle ED PtoC)
\psline[liftpen=2](0,0)(!!CP)% draw from the UNTRANSLATED origin to the current point
}
}


The blue diagram should represent a set of radial lines emerging from the origin to the tip of the unit tangent vector.

## Question

How to draw a line from the untranslated origin to the current point? In other words, how to draw a line from the absolute origin to the current point?

## Note

\pscustom[linecolor=blue]
{
\psline(1,0)
\code{0 /Angle ED}
\multido{\i=1+1}{15}
{
% you can add code here
\translate(!!CP)
\moveto(!1 Angle 1 \i\space 1 sub sqrt Atan add dup /Angle ED PtoC)
%\psline[liftpen=2](0,0)(!!CP)% draw from the UNTRANSLATED origin to the current point
% or you can add code here
}
}

-

Using \translate(!!CP) you move the whole coordinate system around, so that (0,0) no longer refers to the same origin. You can write the whole part without using \translate, but with relative line and move operations (\rlineto and \rmoveto):

\documentclass[pstricks,border=12pt]{standalone}
\SpecialCoor
\usepackage{multido}
\begin{document}
\makeatletter
% draw the tangential lines
\begin{pspicture}[showgrid](-5,-5)(5,5)
\pscustom[linecolor=red]
{
\psline(1,0)
\code{0 /Angle ED}
\multido{\i=1+1}{15}
{
\rlineto(!1 Angle 1 \i\space 1 sub sqrt Atan add dup /Angle ED PtoC)
}
}
\end{pspicture}

\begin{pspicture}[showgrid](-5,-5)(5,5)
\pscustom[linecolor=blue]
{
\psline(1,0)
\code{0 /Angle ED}
\multido{\i=1+1}{15}
{
\rmoveto(!1 Angle 1 \i\space 1 sub sqrt Atan add dup /Angle ED PtoC)
\psline[liftpen=2](0,0)(!!CP)
}
}
\end{pspicture}
\makeatother
\end{document}


If it's only about ignoring the translations, then you can define the origin as a node. The nodes saves the current matrix, and restores the very same point regardless of the translations and scaling which have been done in the meanwhile:

\documentclass[pstricks,border=12pt]{standalone}
\SpecialCoor
\usepackage{multido}
\usepackage{pst-node}
\begin{document}
\begin{pspicture}[showgrid](-5,-5)(5,5)
\pnode(0,0){Origin}
\pscustom[linecolor=blue]
{
\psline(1,0)
\code{0 /Angle ED}
\multido{\i=1+1}{15}
{
\translate(!!CP)
\moveto(!1 Angle 1 \i\space 1 sub sqrt Atan add dup /Angle ED PtoC)
\psline[liftpen=2](Origin)(!!CP)
}
}
\end{pspicture}
\end{document}

-
there is no need for a new translate, rotating does it anyway. –  Herbert Jan 21 at 12:12