![]() |
Forum Index : Microcontroller and PC projects : CMM2: Frustration with arrays....
![]() ![]() |
|||||
Author | Message | ||||
vegipete![]() Guru ![]() Joined: 29/01/2013 Location: CanadaPosts: 1132 |
Top left is 0,0 On the graphics screen as in the editor. Would you like line 0 of your program to be the last line? ;-) Visit Vegipete's *Mite Library for cool programs. |
||||
capsikin Guru ![]() Joined: 30/06/2020 Location: AustraliaPosts: 341 |
Some things you could do to make the library easier to use, could make it more complex to read and understand the library code. If you're writing or using a program that uses a library and want to fully understand how it works, reading the library code can be part of that. |
||||
mkopack73 Senior Member ![]() Joined: 03/07/2020 Location: United StatesPosts: 261 |
Some things you could do to make the library easier to use, could make it more complex to read and understand the library code. If you're writing or using a program that uses a library and want to fully understand how it works, reading the library code can be part of that. For the Array handling stuff I think I've got ways to do things that actually makes it pretty easy to understand. But yeah, if you're trying to do drawing on the screen of graphics and/or text and trying to do it in a screen res + y_axis independent way, that could CERTAINLY get pretty complex and ugly to understand. It's always a trade off. I figure most people who are using a library only want to know WHAT it does, and probably aren't going to get too deep into HOW it works. They're using it because they have some other project they want to do and the library is helping jump start them towards the finish line. If they're using it to learn from, then yeah, probably not the best example in some cases, at least not for beginners... |
||||
JohnS Guru ![]() Joined: 18/11/2011 Location: United KingdomPosts: 4044 |
It was the convention widely adopted by (all of?) the 8-bit BASICs, but was there a reason for it? Was it "easier" to implement somehow The screens of the time (TVs etc) scan from top left so the video out did that too and I think whoever wrote the s/w just reflected what the h/w did. It was common for VDUs (hehe, I'm old, look it up) to be that way (top left = 0,0) for the same reason. Much of software was & is determined by h/w... John |
||||
Paul_L Guru ![]() Joined: 03/03/2016 Location: United StatesPosts: 769 |
Aw heck, it goes back further than the early CRT monitors. Printing a data table or array structure from Hollerith cards to a line printer is really easy if you go from top left to bottom right. Try making a line printer roll the paper back in. I'm probably older than you are. Paul in NY |
||||
lizby Guru ![]() Joined: 17/05/2016 Location: United StatesPosts: 3378 |
In 1974, to visually check the digitizing, I printed a map of the digitized streets in Austin, Texas on a line printer, with "X" representing a pixel. I don't remember how wide and deep it was--at least 12x12 sheets. Top to the right and down was the only way. Then start again for the next 132 pixels of width. Hardware-dependent coordinate system for sure. (But I'm not going to claim to be older than Paul.) PicoMite, Armmite F4, SensorKits, MMBasic Hardware, Games, etc. on fruitoftheshed |
||||
CaptainBoing![]() Guru ![]() Joined: 07/09/2016 Location: United KingdomPosts: 2170 |
0,0 being top left is likely a hold over from the CRT days because the raster refresh was top to bottom. So it made sense that the first line drawn would have the 0 index and thus be at the top... The first time (and only since then) I encountered it was with VB. In a windowing environment, the top left co-ordinate is the one pixel guaranteed to be visible and so it makes sense to have it as the origin. It is hateful though, co-ordinates should be positive in the upper right quadrant like a piece of graph paper, not lower right. I suppose it doesn't really matter much but it is what is easiest on the brain - nice sensible cartesian system. A few years back I wrote some wrappers to get around this (and provide legacy drawing commands) http://www.fruitoftheshed.com/MMBasic.Sensible-Cartesian-Co-ordinate-graphics-pack.ashx They are designed for the micromite but I reckon they will work pretty easily on CMMtoo ![]() Edited 2020-09-15 08:43 by CaptainBoing |
||||
mkopack73 Senior Member ![]() Joined: 03/07/2020 Location: United StatesPosts: 261 |
0,0 being top left is likely a hold over from the CRT days because the raster refresh was top to bottom. So it made sense that the first line drawn would have the 0 index and thus be at the top... The first time (and only since then) I encountered it was with VB. In a windowing environment, the top left co-ordinate is the one pixel guaranteed to be visible and so it makes sense to have it as the origin. It is hateful though, co-ordinates should be positive in the upper right quadrant like a piece of graph paper, not lower right. I suppose it doesn't really matter much but it is what is easiest on the brain - nice sensible cartesian system. A few years back I wrote some wrappers to get around this (and provide legacy drawing commands) http://www.fruitoftheshed.com/MMBasic.Sensible-Cartesian-Co-ordinate-graphics-pack.ashx They are designed for the micromite but I reckon they will work pretty easily on CMMtoo ![]() Heh, you think it's bad now, wait till you deal with trying to convert cartesian map coordinates (with 0 being north) into 3D graphics where Z is front-back, X is left right and Y is up-down! |
||||
Mixtel90![]() Guru ![]() Joined: 05/10/2019 Location: United KingdomPosts: 7937 |
Interestingly, Gordon Henderson's RTB (Return To Basic) for the RPi puts graphic 0,0 at the bottom left by default. It can be moved using the ORIGIN command so that negative values can be plotted. I've not investigated it much, but it's pleasantly idiosyncratic in several other ways too. Including not having an OPTION BASE command. :) Mick Zilog Inside! nascom.info for Nascom & Gemini Preliminary MMBasic docs & my PCB designs |
||||
![]() ![]() |
![]() |
![]() |
The Back Shed's forum code is written, and hosted, in Australia. | © JAQ Software 2025 |