Quick question on co-ordinates
Author |
Message |
xHoly-Divinity
|
Posted: Tue Nov 30, 2004 10:20 pm Post subject: Quick question on co-ordinates |
|
|
Ok, the default location for the coordinates (0,0) is at location 0,0 (bottom left corner). I was wondering if you could change this to set the default location of 0,0 in the middle because I am making a graph and this would be much easier..... is this possible? |
|
|
|
|
![](images/spacer.gif) |
Sponsor Sponsor
![Sponsor Sponsor](templates/subSilver/images/ranks/stars_rank5.gif)
|
|
![](images/spacer.gif) |
Delos
![](http://www.members.shaw.ca/rfolz/delos_avatar.gif)
|
Posted: Tue Nov 30, 2004 10:50 pm Post subject: (No subject) |
|
|
No, you can't change this. But, you can alter your code to make as if your centre is in the middle...
code: |
var cX, cY : int
% Centre x and y.
cX := maxx div 2
cY := maxy div 2
% set them to centres.
drawline (cX, cY, cX + 100, cY + 100, 7)
% Draw a line from (0, 0) [by your new coords] to (100, 100).
|
|
|
|
|
|
![](images/spacer.gif) |
Mazer
![](http://compsci.ca/v3/uploads/user_avatars/1323750815476d9f446d80c.png)
|
Posted: Wed Dec 01, 2004 8:40 am Post subject: (No subject) |
|
|
And if you don't want to be adding to the coordinates each time manually, you could make your own draw procedures that just call the regular ones.
eg:
code: | procedure myDrawFillBox(x1, y1, x2, y2, clr : int)
drawfillbox(x1 + 50, y1 + 50, x2 + 50, y2 + 50, clr)
end myDrawFillBox
|
In this case, we're making the origin 50. You could change that to whatever you'd like (it'd probably be best to make that a constant so you could make changes easier). |
|
|
|
|
![](images/spacer.gif) |
wtd
|
Posted: Wed Dec 01, 2004 2:05 pm Post subject: (No subject) |
|
|
Ack! All of those variables...
Records, people, records!
code: | type Point :
record
x, y : int := 0
end record
var center, max : Point
max.x := 80
max.y := 24
center.x = max.x div 2
center.y = max.y div 2 |
|
|
|
|
|
![](images/spacer.gif) |
SuperGenius
|
Posted: Wed Dec 01, 2004 5:41 pm Post subject: (No subject) |
|
|
Records might be a little confusing for a lot of people...I never learned them in gr. 10 myself. |
|
|
|
|
![](images/spacer.gif) |
wtd
|
Posted: Wed Dec 01, 2004 6:27 pm Post subject: (No subject) |
|
|
SuperGenius wrote: Records might be a little confusing for a lot of people...I never learned them in gr. 10 myself.
Everything's confusing the first time you see it. You just have to use them to get used to them. |
|
|
|
|
![](images/spacer.gif) |
|
|