[OS X TeX] translating objects in pstricks

Ross Moore ross.moore at mq.edu.au
Thu Jul 15 19:06:38 EDT 2021


Hi Zbigniew,

On 16 Jul 2021, at 5:08 am, Nitecki, Zbigniew H. <Zbigniew.Nitecki at tufts.edu<mailto:Zbigniew.Nitecki at tufts.edu>> wrote:

I designed a small macro to draw a “tear”-shaped curve using \psbezier.  It works as expected.
For simplicity, I wrote it with features related to the coordinate axes.
Then, I tried to create a new macro, “blip”, which gives a translate of this picture to a specified position.

I tried two options (see attached example) .
In the pdf, the lower figure is generated using just the \tear  macro, while the upper one is generated using the \blip macro.
The \blip figure has some extra lines—I suspect they are caused by my use of \pscustom to create the translated picture.
 I followed the example on p. 130 of Herbert Voss’s “Pstricks” (in the English translation).

I thought I could get away with just defining \blip using \tear without a \pscustom  envelope, but if I comment out the \pscustom part like this:
\newcommand{\blip}[5]{%\pscustom{% usage:\blip{A}{B}{a}[b}{c} = \tear{a}{b}{c} moved so (0,0)->(A,B)
\translate(#1,#2)
\tear{#3}{#4}{#5}
% }
}
I get an error message, that \tear is undefined (it is still present in the file, preceding this definition).

Can anyone suggest how I can translate the picture generated by \tear  without introducing the extra lines?  I know this is probably a pretty stupid issue, but I haven’t succeeded in understanding how to
do it from the LaTeX Graphics Companion (there is a complicated example involving creating nodes, etc., surely there is an easier more direct way).


This does what you want:

\begin{pspicture}(-5,-5)(5,5)
\tear{1}{5}{7}
\pscustom{\translate(3,3)
\psbezier(1,-1)(0,0)(0,0)(-5,0)}%
\pscustom{\translate(3,3)
\psbezier(-5,0)(-7,0)(0,7)(0,5)}%
\pscustom{\translate(3,3)
\psbezier(0,5)(0,0)(0,0)(1,-1)}%
\end{pspicture}

So the lesson is that you need to wrap  \pscustom {\translate (…}  }
around *each* of the Bézier pieces separately.

Probably what is happening is that the origin (or whatever is the  currentpoint  at the time)
is regarded as part of the Postscript path, giving you an extra straight segment at the beginning
or end of a  Bézier piece.
That is, within a single  \pscustom{ . . . }  the different  Bézier pieces combine to give
a single Postscript curve specification, drawn at the end.

By breaking up the pieces into their own \pscustom {…}
you draw each piece entirely independent from the others.
(so no automatic connection between the pieces.)

It is then up to you to make sure they fit together seamlessly.


Oh, and move the \newcommand  definitions outside of the {pspicture}
environment; else you have to repeat them each time you want them.


Hope this helps.

Ross



Zbigniew Nitecki
Department of Mathematics
Tufts University
Medford, MA 02155

telephones:
Office    (617)627-3843
Dept.    (617)627-3234
Dept. fax    (617)627-3966
http://www.tufts.edu/~znitecki/<http://www.tufts.edu/~znitecki/>




<Beziertest.tex><Beziertest.pdf>----------- Please Consult the Following Before Posting -----------
TeX FAQ: http://www.tex.ac.uk/faq
List Reminders and Etiquette: https://sites.esm.psu.edu/~gray/TeX
List Archives: http://dir.gmane.org/gmane.comp.tex.macosx
               https://email.esm.psu.edu/pipermail/macosx-tex
TeX on Mac OS X Website: http://mactex-wiki.tug.org
List Info: https://email.esm.psu.edu/mailman/listinfo/macosx-tex


Dr Ross Moore
Department of Mathematics and Statistics
12 Wally’s Walk, Level 7, Room 734
Macquarie University, NSW 2109, Australia
T: +61 2 9850 8955  |  F: +61 2 9850 8114
M:+61 407 288 255  |  E: ross.moore at mq.edu.au<mailto:ross.moore at mq.edu.au>
http://www.maths.mq.edu.au
[cid:image001.png at 01D030BE.D37A46F0]
CRICOS Provider Number 00002J. Think before you print.
Please consider the environment before printing this email.

This message is intended for the addressee named and may
contain confidential information. If you are not the intended
recipient, please delete it and notify the sender. Views expressed
in this message are those of the individual sender, and are not
necessarily the views of Macquarie University. <http://mq.edu.au/>
<http://mq.edu.au/>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://email.esm.psu.edu/pipermail/macosx-tex/attachments/20210715/3d2345f5/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image001.png
Type: image/png
Size: 4605 bytes
Desc: image001.png
URL: <https://email.esm.psu.edu/pipermail/macosx-tex/attachments/20210715/3d2345f5/attachment.png>


More information about the MacOSX-TeX mailing list