[OS X TeX] translating objects in pstricks

Manfred Braun manfred.braun at uni-due.de
Fri Jul 16 04:09:59 EDT 2021


Hi Zbigniew and Ross,

I think it depends very much on how exactly \tear is defined. The following version works:

\newcommand\tear[3]{\psbezier
  (#1,-#1)(0,0)(0,0)(-#2,0)
          (-#3,0)(0,#3)(0,#2)
          (0,0)(0,0)(#1,-#1)
}
\newcommand\blip[5]{%
  \pscustom{\translate(#1,#2)\tear{#3}{#4}{#5}}%
}
\begin{document}
\begin{pspicture}(-5.5,-1)(5,7.5)
  \tear{1}{5}{7}
  \psset{linecolor=red}    
  \blip{4}{2}{1}{5}{7}
\end{pspicture}

Note that the starting points of the second and third bezier arcs are omitted. \psbezier assumes implicitly that these arcs start at the current position, i.e., at the last point of the previous arc.With this definition of \tear there is no need to wrap every arc into a \pscustom command separately, as suggested by Ross.

Manfred

> On 16 Jul 2021, at 01:06, Ross Moore <ross.moore at mq.edu.au> wrote:
> 
> 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: https://protect-au.mimecast.com/s/MoWIC0YKgRsKlD1gCDYrJ4?domain=tex.ac.uk <http://www.tex.ac.uk/faq>
>> List Reminders and Etiquette: https://protect-au.mimecast.com/s/2dy4CgZ05JfrnxMwi26nTZ?domain=sites.esm.psu.edu <https://sites.esm.psu.edu/~gray/TeX>
>> List Archives: https://protect-au.mimecast.com/s/HDhqCjZ12Rf2kMWGt7aT74?domain=dir.gmane.org <http://dir.gmane.org/gmane.comp.tex.macosx>
>>                https://email.esm.psu.edu/pipermail/macosx-tex <https://email.esm.psu.edu/pipermail/macosx-tex>
>> TeX on Mac OS X Website: https://protect-au.mimecast.com/s/hYLYClx1OYUyD5QPUY_ium?domain=mactex-wiki.tug.org <http://mactex-wiki.tug.org/>
>> List Info: https://protect-au.mimecast.com/s/i-NXCmO5wZsZGKOPHNR4BY?domain=email.esm.psu.edu <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 <http://www.maths.mq.edu.au/>
> <image001.png>
> 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/>
> ----------- 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

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://email.esm.psu.edu/pipermail/macosx-tex/attachments/20210716/7928f9e4/attachment.htm>


More information about the MacOSX-TeX mailing list