Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.postscript > #3330
| From | Scott Hemphill <hemphill@hemphills.net> |
|---|---|
| Newsgroups | comp.lang.postscript |
| Subject | Re: postscript newbie has questions |
| References | <f6bea1cb-1861-49ac-9a6c-6cfba86e3a42@googlegroups.com> |
| Date | 2018-11-12 09:12 -0500 |
| Message-ID | <87bm6ucrlw.fsf@hemphills.net> (permalink) |
Eric Lovejoy <blicken@gmail.com> writes:
> Hello all, I am new to postscript programing, it is my first stack
> based programing language, my background is in C/C++, programing
> embedded systems.
>
>
>
> In any event, I have some basic operations I am trying to utilize, and
> things seem to not be working. keep in mind, I am very new to the
> postscript language. I am also working on a linux machine, using the
> ghostscript interpreter.
>
> One problem I am having a hard time with is understanding how to
> change a variable, after defining it.
>
> take this example:
>
> %arc takes x,y,radius,start degree, end degree.
> /r 144 def
> 0 0 r 0 360 arc
> 1 0 1 setrgbcolor
> stroke
> 4{ r -24 sub r
> 0 0 r 0 360 arc
> 0 1 0 setrgbcolor
> stroke} repeat
>
>
> my goal with this code snippet is to make incrementally smaller
> circles by decrimenting variable "r".
> This doesnt work, I get one circle.
> I have tried a variety of /r -24 sub r, /r -24 sub /r, r -24 sub /r,
> etc. but nothing like this works. what Iam I doing wrong?
I assume you want to subtract 24 from the value of r. If you subtract
-24 from the value of r, you will be adding 24 to its value. So
something like this should work:
/r r 24 sub def
Scott
--
Scott Hemphill hemphill@alumni.caltech.edu
"This isn't flying. This is falling, with style." -- Buzz Lightyear
Back to comp.lang.postscript | Previous | Next — Previous in thread | Find similar
postscript newbie has questions Eric Lovejoy <blicken@gmail.com> - 2018-11-07 15:59 -0800 Re: postscript newbie has questions luser droog <luser.droog@gmail.com> - 2018-11-07 20:17 -0800 Re: postscript newbie has questions Scott Hemphill <hemphill@hemphills.net> - 2018-11-12 09:12 -0500
csiph-web