🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: adobe.postscript.programming
Article #23

Finding and storing x and y coordinates

#23
From: Eric_Burton
Date: Mon, 02 Feb 2009 17:16
20 lines
1707 bytes
I need to somehow store a given set of x & y coordinates into a def. When I draw a path to a certain point, the program needs to store that point in a def to use it later on. For instance, the program will be deciding whether to draw a line to the left or to the right, depending on whether or not it's x value is greater than (to the right of) the center of the page, or less than (to the left of) the center.

the logic is as such:

{
Draw a circle with circleX and circleY as the center
Draw a line from the edge of the circle out 10 points
Now after you draw this line, where are you (what is your x,y)?
     Store those x,y coordinates into defs named previousX, and previousY.
          if previousX is greater than or equal to circleX, then draw a
          line to the right. If not, then draw a line to the left.
}

I have been using currentpoint with success when creating a new origin point for arcs and whatnot, but something like

/previousPoint currentpoint def

just doesn't work. I also cannot compare currentpoint with circleX and get any helpful return.

Anyone know a good way to "get" the x and or y at the current point?
Technical Details
Message-ID: <59b7c205.-1@webcrossing.la2eafNXanI>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!newshub.sdsu.edu!webcrossing

Show Full Headers
Complete Article Headers
X-Google-Thread: 10c61a,183b33a665839377,start
X-Google-Attributes: gid10c61a,domainid0,public,usenet
X-Google-Language: ENGLISH,ASCII-7-bit
From: Eric_Burton@adobeforums.com
Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!newshub.sdsu.edu!webcrossing
Newsgroups: adobe.postscript.programming
Subject: Finding and storing x and y coordinates
Message-ID: <59b7c205.-1@webcrossing.la2eafNXanI>
Date: Mon, 2 Feb 2009 09:16:56 -0800
Lines: 28
MIME-Version: 1.0
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit