🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: adobe.postscript.programming
3 messages
3 total messages Started by Eric_Burton Mon, 02 Feb 2009 17:16
Finding and storing x and y coordinates
#23
Author: 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?
Re: Finding and storing x and y coordinates
#24
Author: Eric_Burton
Date: Mon, 02 Feb 2009 19:05
7 lines
974 bytes
Update:

tentatively,

/previousX currentpoint pop def

seems to work, at least for my purposes here. Could have sworn that was not before. Please someone show me if there is a better way, or if my thinking is wrong. I am assuming that currentpoint pushes x and then y on the stack, so in order to get x, you have to pop y off.
Re: Finding and storing x and y coordinates
#28
Author: Helge_Blischke
Date: Thu, 05 Feb 2009 13:35
3 lines
625 bytes
Yes, you are right.

Helge
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads