Board Logo
« rows and cols vrs x and y »

Welcome Guest. Please Login or Register.
Oct 17th, 2017, 3:27pm


Conforums Terms of Service | Membership Rules | Home | Search | Recent Posts | Notification | Format Your Message | Installation FAQ

Please use the forums Search feature before asking.
Please post code using the code box described in Format Your Messages.
This will keep indentation, separate it better form the message and prevent gibberish.
If the code is too long for one post or additional files are needed, upload a ZIP archive to the Just BASIC Files Archive Site.

« Previous Topic | Next Topic »
Pages: 1  Notify Send Topic Print
 thread  Author  Topic: rows and cols vrs x and y  (Read 174 times)
bplus
Senior Member
ImageImageImageImageImage


member is offline

Avatar




PM

Gender: Male
Posts: 1180
xx Re: rows and cols vrs x and y
« Reply #8 on: Oct 6th, 2017, 11:31am »

It's funny until this issue came up, I never thought of database display as much of a row, column thing as far as display goes, I had it in a different category onto itself I guess. Thus, my original post.

Generally you look up a record and then the field you are interested in (record, field) order.

Now! I see that the old Classic BASIC's were being consistent between LOCATE and database display! That is an eye / mind opener. Locate row, col

So one might say that graphics was the inconsistent one but in math the independent variable is traditionally pinned to the horizontal x-axis and graphs based on that. Surely a BASIC would want to remain consistent to that also (since BASIC started out helping math students (not yet committed to computer science (until strings entered the picture)). You start with an x and find it's y value, (x, y) but the y axis increases going down... hmm.

It does look as if LOCATE was originally based on database display.

But one has to remember in old days everything was printed and with that you have to start at top left of page and work your way with increasing line numbers, so that is maybe where y increases going down instead of up. Yep! I bet printing was the deciding factor of order choices.

When screens came into the picture, you needed LOCATE to jump around the screen because even though screens can roll down, you could no longer view contents at top until that was improved with scroll...
« Last Edit: Oct 6th, 2017, 11:40am by bplus » User IP Logged

B+
Rod
Administrator
ImageImageImageImageImage


member is offline

Avatar

Graphics = Goosebumps!


PM

Gender: Male
Posts: 3100
xx Re: rows and cols vrs x and y
« Reply #9 on: Oct 6th, 2017, 11:33am »

Probably the confusion stems from the fact that we can't use sort() in JB and have been free to choose our own conventions about how grids are defined. I don't even use sort() very often in LB due to quirks and bugs that Anatoly has clarified. I roll my own mostly and so can choose which dimension to sort on.

Perhaps the trick is to use meaningful names.

Code:


    'set up a 6x12 grid
    records=6   'x
    fields=12   'y

    'fill the grid with data
    dim dbf$(records,fields)
    for r=1 to records
        for f=1 to fields
            if f=1 then dbf$(r,f)=str$(r)else dbf$(r,f)=str$(int(rnd(0)*100))
        next f
    next r

    print "unsorted"
    print "records / fields---->"
    print "   |"
    print "   |"
    print "   |"
    print "   v"
    for r=1 to records
        for f=1 to fields
            print dbf$(r,f),
        next f
        print
    next r
    print
    print

    print "fields / records---->"
    print "   |"
    print "   |"
    print "   |"
    print "   v"
    for f=1 to fields
        for r=1 to records
            print dbf$(r,f),
        next r
        print
    next f

    wait


    [quit]
    close #main
    end
 
User IP Logged

rtr
Member in Training
ImageImage


member is online

Avatar




PM


Posts: 29
xx Re: rows and cols vrs x and y
« Reply #10 on: Oct 6th, 2017, 12:43pm »

on Oct 6th, 2017, 11:31am, bplus wrote:
y increases going down instead of up.

In Liberty BASIC and Just BASIC, yes, but far from universally. For example in BBC BASIC positive Y is upwards (and 0,0 is the bottom left corner); the same is true in OpenGL and in PostScript, and in BMP files (indeed all Windows DIBs), and no doubt others.

The Cartesian Coordinate system we were taught at school has its origin at the bottom left corner, so it's arguable that the computer graphics that work the other way - and admittedly they are in the majority - are out of step.

It's generally thought that the positive-downwards convention stems from the way Cathode Ray Tube TV screens are (or were) scanned, which is a pretty poor reason to break with centuries of tradition.

Richard.
User IP Logged

tsh73
JB-Supporter


member is offline

Avatar




PM

Gender: Male
Posts: 3558
xx Re: rows and cols vrs x and y
« Reply #11 on: Oct 6th, 2017, 12:58pm »

Code:
It's generally thought that the positive-downwards convention stems from the way Cathode Ray Tube TV screens are (or were) scanned,  

I would vote for printing origin. With it, Y doing down makes perfect sense.

I confess in my early BASIC days I had hard time deciding
(row, column)
or
(column, row)
(and even "Y goes upward or downward")
Because obviously from mathematical point of view it's the same...
So I had to decide it for each program.
And all was fine until I mess it up in the middle of a program ;)
Now I just got used to (row, column), from top to bottom - but it's just convenience.
EDIT I don't have to think about it any more ;)

Luckily I happen to remember that LB sort bug.
Since I mainly use JB I don't use SORT often.
« Last Edit: Oct 6th, 2017, 1:00pm by tsh73 » User IP Logged

Q: "And if I took your codes and compile them, and sell them for a profit"?
A: Go ahead. I had my share of good then I coded it for fun, if you can make better use of it - please do.
(enjoying JB 1.01 on WinXP, netbook and desktop)
Rod
Administrator
ImageImageImageImageImage


member is offline

Avatar

Graphics = Goosebumps!


PM

Gender: Male
Posts: 3100
xx Re: rows and cols vrs x and y
« Reply #12 on: Oct 6th, 2017, 12:58pm »

Especially as it would have been just as simple to scan up as down! Perhaps it all went wrong when John Logie Baird spun his disc clockwise and set the screen position on the down stroke. He should have spun it anti clockwise.

Edit to add, or indeed spun it clockwise and set the screen position on the up stroke! skinning cats springs to mind.
« Last Edit: Oct 6th, 2017, 4:15pm by Rod » User IP Logged

rtr
Member in Training
ImageImage


member is online

Avatar




PM


Posts: 29
xx Re: rows and cols vrs x and y
« Reply #13 on: Oct 6th, 2017, 5:28pm »

on Oct 6th, 2017, 12:58pm, tsh73 wrote:
I would vote for printing origin. With it, Y doing down makes perfect sense.

So in countries that use Arabic or Hebrew writing, for example (where the printing origin is top-right), you would have positive Y going downwards but positive X going right-to-left? laugh

Richard.
User IP Logged

Pages: 1  Notify Send Topic Print
« Previous Topic | Next Topic »

Conforums Terms of Service | Membership Rules | Home | Search | Recent Posts | Notification | Format Your Message | Installation FAQ

Donate $6.99 for 50,000 Ad-Free Pageviews!

| |

This forum powered for FREE by Conforums ©
Sign up for your own Free Message Board today!
Terms of Service | Privacy Policy | Conforums Support | Parental Controls