[pstricks] Normal arrows along a curve

Michael Sharpe msharpe at ucsd.edu
Mon Aug 9 04:56:46 CEST 2010

On Aug 1, 2010, at 11:27 AM, James wrote:

> I took another look at the pstricks-add document, turns out I was looking at an old version. Using the (real) latest version, the parametric plot stuff worked fine, and actually works like I was wishing/hoping it would. I do need to define a better looking parametric plot, since right now I am just using a circle. But this code is what I am using, and if I get obsessive compulsive enough, I want to tweek the number of tick lines so that it scales (down) better.
>
>
> \scalebox{1.0} % Change this value to rescale the drawing.
> {
> \begin{pspicture}(0,0)(4,4)
>    \psparametricplot[plotpoints=100,linewidth=0.04]{90}{270}{t cos 1 add 1.5 mul t sin 1 add 1.5 mul}
>    \psparametricplot[plotpoints=100,linewidth=0.04,linestyle=dotted,dotsep=0.16cm]{270}{450}{t cos 1 add 1.5 mul t sin 1 add 1.5 mul}
>    \pscurvepoints[plotpoints=100]{270}{450}{t cos 1 add 1.5 mul t sin 1 add 1.5 mul}{P}%
>    \pspolylineticks[Os=0,Ds=0.22,ticksize=0 0]{P}%
>    { ds }{0}{22}% distance
>    \multido{\i=0+1}{22}{\psrline[arrows=->,arrowscale=1.0,linewidth=0.03](PTick\i)(-7pt;{(PNormal
> \i)})}%
> \usefont{T1}{ptm}{m}{n}
> \rput(0.1,2.8){$\partial{\Omega}_D$}
> \usefont{T1}{ptm}{m}{n}
> \rput(3.0,-0.05){$\partial{\Omega}_N$}
> \usefont{T1}{ptm}{m}{n}
> \rput(1.6,1.5){$\Omega$}
> \end{pspicture}
> }
>
>
> Thanks for your help, and if you have an critiques, I'd love them.

James,

1. There is no need to do \useffont. Just enter \uepckage{mathptmx} in the preamble to get Times.
2. It's better to change scale with \psset{unit=...} (The default  unit is 1cm.) That way, graphic elements are scaled (unless specified with a unit, like 6pt) but fonts are not resized.
3. The dotted style doesn't add much, in my opinion. You might consider omitting the dots and using a background color for the shape, as in the example below.
4. The log file will tell you the metric range---in this case, arc length from 0 to 4.712, so you'll get a better looking separation when you divide that by 23 for the separation between arrows.
5. You should start and end both arrows in the same way relative to the rest of the curve. In my opinion, it looks better when both are separated from the solid curve by the same amount of space as the separation between arrows. Half that value would also look good.

\usepackage{mathptmx}
\begin{document}
%for scaling, use \psset{unit=...}
\begin{pspicture}(0,0)(4,4)
\psparametricplot*[plotpoints=100,linecolor=black!20]{0}{360}{t cos 1 add 1.5 mul t sin 1 add 1.5 mul}
\psparametricplot[plotpoints=100]{90}{270}{t cos 1 add 1.5 mul t sin 1 add 1.5 mul}
\pscurvepoints[plotpoints=100]{270}{450}{t cos 1 add 1.5 mul t sin 1 add 1.5 mul}{P}%
\pspolylineticks[Os=0,Ds=0.2142,ticksize=0 0]{P}%.2142=4.712/23 (4.712=metric range, from log)
{ ds }{0}{23}% distance
\multido{\i=1+1}{22}{\psrline[arrows=->,arrowscale=1.0,linewidth=.4pt](PTick\i)(-7pt;{(PNormal\i)})}%
\rput(0.1,2.8){$\partial{\Omega}_D$}
\rput(3.0,-0.05){$\partial{\Omega}_N$}
\rput(1.6,1.5){$\Omega$}
\end{pspicture}

Michael