Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.
Joined: 13/02/2015 Location: United StatesPosts: 323
Posted: 06:04pm 24 Nov 2020
Copy link to clipboard
Print this post
It's possible I may have missed it in the manual but is there a way to set your own coordinates and have the graphics commands use those coordinates or can you only refer to absolute pixel locations?
ANSI Standard BASIC Example:
WINDOW (1956,2025)-(0,150)
would set the x-axis from 1956 to 2025 and the y-axis from 0 to 150 so if you wanted to plot 83 years old as the average lifespan of people in 1972, you could do this
PLOT POINTS: 1972, 83
rather than having to figure out screen pixel coordinates.
If this facility isn't available, could it be added?
RetroJoe
Senior Member
Joined: 06/08/2020 Location: CanadaPosts: 290
Posted: 06:57pm 24 Nov 2020
Copy link to clipboard
Print this post
Not aware of anything like this, either - kinda cool capability, though.
Does this ANSI BASIC axis normalization work for negative values as well?
Anyway, seems like a fairly simply problem to fix with a MMBasic SUB function or two, as it would depend on the CMM2 graphics mode you are in, and what you would want to do with plot values that are outside the specified range.
FYI, the only recent MMBasic development I know of along these lines was an option to flip the Y axis such that the (0,0) origin is at the lower-left instead of the top-left of the screen, intended to ease the cognitive dissonance for students who just learned in algebra class that the Y-axis increases northward :) Edited 2020-11-25 04:57 by RetroJoeEnjoy Every Sandwich / Joe P.
toml_12953 Guru
Joined: 13/02/2015 Location: United StatesPosts: 323
Posted: 07:05pm 24 Nov 2020
Copy link to clipboard
Print this post
I just read about OPTION Y_AXIS. It does help with some older -non-MMBASIC programs.
As far as negative values, yes. The coordinates are totally up to you. You can set the origin to anywhere on the monitor, even!
SET WINDOW -2*pi,2*pi, -1,1
will give you a nice graph of trig functions that fill the screen.
for a=-2*pi to 2*pi step .01 plot points: a,sin(a) next a
You can see how easy it is to create simple graphs. Edited 2020-11-25 05:47 by toml_12953
Nimue
Guru
Joined: 06/08/2020 Location: United KingdomPosts: 367
Posted: 09:04am 25 Nov 2020
Copy link to clipboard
Print this post
Sometimes a feature request comes along that you didn't release you needed until you read it.
That said, scaling the screen to create coordinates has proved to be a good "learning point" for my students.
NimEntropy is not what it used to be
toml_12953 Guru
Joined: 13/02/2015 Location: United StatesPosts: 323
Posted: 09:10am 25 Nov 2020
Copy link to clipboard
Print this post
Oops! I got the syntax wrong! It should be
SET WINDOW 1956,2025,0,150
the order of parameters is: xmin,xmax,ymin,ymax Edited 2020-11-25 19:10 by toml_12953
matherp Guru
Joined: 11/12/2012 Location: United KingdomPosts: 8516
Posted: 09:10am 25 Nov 2020
Copy link to clipboard
Print this post
This isn't going to happen. Trivial for me or the user with a subroutine for individual pixels but what about all the other drawing commands?
toml_12953 Guru
Joined: 13/02/2015 Location: United StatesPosts: 323
Posted: 09:16am 25 Nov 2020
Copy link to clipboard
Print this post
In ANSI/ISO BASIC all the graphics commands obey the SET WINDOW coordinates.
If you do a
SET WINDOW -100,100,-100,100
Then a drawing a circle with center (0,0) will make the circle be drawn at the center of the screen.
matherp Guru
Joined: 11/12/2012 Location: United KingdomPosts: 8516
Posted: 09:18am 25 Nov 2020
Copy link to clipboard
Print this post
And text? and blit? and sprites? Edited 2020-11-25 19:30 by matherp
toml_12953 Guru
Joined: 13/02/2015 Location: United StatesPosts: 323
Posted: 09:37am 25 Nov 2020
Copy link to clipboard
Print this post
And text? and blit? and sprites?
If you PRINT, the text is a standard size. If you PLOT TEXT, it obeys your SET WINDOW.
ANSI/ISO BASIC has no SPRITE capability. A BLIT (called DRAW in ANSI/ISO) obeys the SET WINDOW but there's no native sprite capability. You have to create a mask of your shape, then DRAW the MASK and DRAW the shape over the mask with XOR. This also obeys the SET WINDOW. Edited 2020-11-25 19:37 by toml_12953