Posted By
SVS on 2017-03-16 09:05:23
| Use of CIRCLE command in Multicolor Mode
A question for you, graphic masters!
As known the resolution of Multicolor Screen is 160*200 instead of 320*200 of Hires one. The Basic commands (Box, Circle, etc.) seem do not consider this when they draw their figures. The result is that the pictures are distorted (especially if is set an inclination). Well: is there a way to correct this distortion in order to obtain plain figures even if inclined? Thank you.
|
|
Posted By
MMS on 2017-03-18 06:11:00
| Re: Use of CIRCLE command in Multicolor Mode
Sorry to answer to this, as I am not a graphic master, just to share what I learned from the books
Plus/4 Programmers reference guide Page 23: (as a conclusion: even in HIRES mode you need a little smaller vertical diamater to get a real circle instead of oval)
"4. Vertical radius is the distance from the center of the shape to the top and bottom of the shape. Because vertical dots on the high-resolution graphic screen are slightly farther apart than horizontal dots are, when the vertical and horizon tal radii have the same value, the shape drawn is an oval, not a circle. To draw a circle, the vertical radius must be scaled to the horizontal radius (e.g., 50 horizon tal, 47 vertical). For multicolor coordinates, 25 horizontal is about 47 vertical."
I think that if you want to keep the same commands irrespective of the mode you use (or do not know in advance), you may use the SCALE command. In fact I've never understood how it could be really useful, maybe in a CAD program? :-D
Programmer's reference Guide:
"The SCALE command lets you change these values to 1024 logical dots both across and down in any mode. In particular, this is useful when you are unsure whether a final program will run in high-resolution or in multicolor mode. If you do all the drawing with SCALE on, the figures will be the same size in either mode. No coordinate transformations are required to move between high resolution and multicolor SCALEd coordinates. The SCALE command may be executed at any time and remains in effect until canceled. After you turn on scaling, you must adapt the drawing commands to the new screen coordinates. For example, the center of the high-res screen is no longer 160,100. It is now 512,512. To calculate SCALEd values from high resolution or multicolor coordinates, use these formulas: High-res rows 5.12 * row coordinate High-res columns 3.2 * column coordinate Multicolor rows 5.12 * row coordinate Multicolor columns 6.4 * column coordinate
For example, to get the same circle as drawn without SCALE by CIRCLE, 160,100,60,50, you can use the following lines with SCALE:
5 SCALE 1 10 A = 3.2 * 160: B = 5.1S * 100 20 C = 3.2 * 60: D = 5.12 * 50 30 GRAPHIC 2,1 40 CIRCLEA3,C,D"
|
|
Posted By
SVS on 2017-03-20 04:19:02
| Re: Use of CIRCLE command in Multicolor Mode
Thank you MMS. I'll perform some tests and then feed back.
*EDIT* The problem is the "inclination" of the shape. For example an equilateral triangle results distorted even after SCALE 1. The same one without inclination results correct even without SCALE.
But there is an exception: if you specify as parameters only: center' coordinates, first ray, and sides' angle (leaving default for the others) then the shape will result correct.
|
|
Posted By
MMS on 2017-04-29 06:27:55
| Re: Use of CIRCLE command in Multicolor Mode
Hi SVS
just by accident I noticed the BLARG BASIC extension to C64, by SLJ (Stephen Judd)
It is only HIRES,unfortunately It has a well documented (though not multicolor) Circle routine, that is 1) more round (and not 128 sided polygon) 2) stated to be 49x faster than the BASIC7.0 routine (that should be close to 3.5 version speed)
May worth a look, if you gave up with the built in routine. Certainly it requires the change of the code and the memory addresses. http://www.ffd2.com/fridge/programs/blarg/
I tested it with a C64 emu (Micro64) and the Circle and Line route are pretty fast. He was able to demonstrate a Tunnel Demo with 1-3 sec updates, and that is really impressive in BASIC!
An other option: There was a BASIC routine from the same guy (SLJ) to implement ROUND circle based on BASIC mathematical calculations, without using complex ones. Not using PI or any other complex floating point stuff, and that speeds up things significantly.
Built in BASIC3.5 routine is faster (as it is an assembly code ), but this one also looks good, and the shape look a little better in HIRES. Multicolor modification not done. I tried with Autrospeed (could speed things up), but maybe I am not experienced enough with it, I failed to create a running file (maybe too small/short code).
It was in the Commodore Hack magazine: http://codebase64.org/doku.php?id=magazines:chacking9&s[]=circle
The code. it draws a nice HIRES full Circle, but I played with it a little and you can adjust the drawns sections, and the steps.
In multicolor it works, but the horizontal radius doubles (logically), but it is not a circle any more. Could be solved somehow (easily), but math is not my strong part (next to the lot of other weaknesses I have, haha )
0 REM FAST CIRCLE -- SLJ 9/94 10 GRAPHIC 1,1 15 REM X=Radius 20 X=40:Y=0:TX=X:XO=160:YO=100 30 DRAW1,X+XO,Y+YO: DRAW1,Y+XO,X+YO 40 DRAW1,XO-X,YO+Y: DRAW1,XO-Y,YO+X 50 DRAW1,XO-X,YO-Y: DRAW1,XO-Y,YO-X 60 DRAW1,XO+X,YO-Y: DRAW1,XO+Y,YO-X 70 IF X<=Y THEN 100 80 Y=Y+1:TX=TX-Y 90 IF TX<0 THEN X=X-1:TX=TX+X 95 GOTO 30 100 END And next to each othet the built-in CIRCLE routine and the SLJ one.
|
|
|