| Home CBM ASCII-X BASIC Disk Commands Enter RUN mode Program Format Secret Variables Variable Format Expressions Keywords (divide) (equal) (less) (minus) (more) (multiply) (plus) (power) Abs And Append Asc Atn Auto Backup Bank Begin Bend Bload Boot Box Bsave Bump Catalog Char Chr Circle Close Clr Cmd Collect Collision Color Concat Cont Copy Cos Data Dclear Dclose Dec Def Delete Dim Directory Dispose Dload Do Dopen Draw Ds Ds string Dsave Dverify El Else End Envelope Er Err Exit Exp Fast Fetch Filter Fn For Fre Get Get num Getkey Go Gosub Goto Graphic Gshape Header Help Hex If Input Input num Instr Int Joy Key Left Len Let List Load Locate Log Loop Mid Monitor Movspr New Next Not Off On Open Or Paint Peek Pen Pi Play Pointer Poke Pos Pot Print num Pudef Quit Rclr Rdot Read Record Rem Rename Renumber Restore Resume Return Rgr Right Rlum Rnd Rreg Rspcolor Rsppos Rsprite Run Rwindow Save Scale Scnclr Scratch Sgn Sin Sleep Slow Sound Spc Sprcolor Sprdef Sprite Sprsav Sqr Sshape St Stash Step Stop Str Swap Sys Tab Tan Tempo Then Ti Ti string To Trap Troff Tron Until Using Usr Val Verify Vol Wait While Width Window Xor Syntax Tokens C128 D64plus Disk Escape Codes Hardware PCxface PETSCII Pet2asc Futurama IBM PC-AT Contact Games Glossary Hall of fame Hall of shame Miscellaneous Privacy policy Programming Twisty puzzles |
CIRCLE [ colorSource ] [ , { [ + | - ] xVal [ , [ + | - ] yVal ] | distance ; angle } [ , [ xRadius ] [ , [ yRadius ] [ , [ startArc ] [ , [ endArc ] [ , [ rotation ] [ , stepAngle ] ] ] ] ] ] ]
*Due to a bug in the original C128 ROMs (start-up message says (c)1985), only positive/unsigned values of 0 to 65535 may be used.
Plot a (partial) ellipse or regular polygon on the bitmap screen.
All parameters are optional. Without any, CIRCLE will (slowly) plot a single pixel (actually the same pixel 180 times). The coordinate (after the optional colorSource) defines the center of the "circle"; if not specified, it defaults to the "pixel cursor" (the last point calculated in the previous bitmap command). A specified coordinate will be effected by SCALE if it is active. The resulting values may be off-screen, as long as they are legal as shown above. The optional xRadius and yRadius define the size of the "circle". The width of a complete (and non-rotated) "circle" is defined by two times xRadius (default 0). The height of a complete (and non-rotated) "circle" is defined by two times yRadius. The default yRadius depends on the GRAPHIC mode. For high-resolution, it is the same as xRadius; for multi-color, it is twice the xRadius. Because the pixels are not square (in either mode), the result will be an ellipse instead of a true circle (assuming all the following parameters use default values). A complete "circle" need not be drawn. A "partial circle" or arc may be drawn instead. To do this, specify a startArc and endArc with a difference less than 360 (the length of the arc in degrees). The endArc should be greater than startArc or you will get strange results! Either (or both) may be more than 360 degrees, in this case the result is the same as if both values were modified by subtracting startArc - Mod(startArc, 360) from both values. If that doesn't make sense, then just keep startArc in the range 0 to 359 and endArc in the range 0 to 719 such that endArc >= startArc (and usually endArc-startArc <= 360). And if that doesn't make sense, you'll just have to play around with it! The rotation will rotate the "circle" by the specified number of degrees. If you can manage to draw a true circle, this will have no effect (assuming default stepAngle). In the typical case (an ellipse, not a true circle), the angle is only relevent modulo 180 due to symmetry. For example a rotation of 45 is effectively the same as a rotation of 225 or 405 (45 + 180*1 or 45 + 180*2). The stepAngle can be used to generate regular polygons instead of an ellipse/circle. You see, by default, this command really draws a 180-sided polygon! The number of sides in the polygon equals 360 divided by the stepAngle (so with the default value of 2, you get 360/2 = 180 sides). Here are values for polygons you may want to try:
As you exceed 12 sides, the result looks more and more like a circle (as the stepAngle gets smaller). If you are not drawing a very large (near full-screen) size circle, using a stepAngle of 10 should give acceptable results (a 36-sided polygon) but render noticebly faster than the default value. The width plotted on screen of each "dot" of all line-segments is controlled by a secret BASIC variable. That secret variable can be set with WIDTH. If it is 1, each dot will be 1 pixel wide; if it is 2, each dot will be 2 pixels wide. Strangely in all versions, negative angles are not allowed! Try adding 360 (or 720) to fix this problem (this works for positive angles too), but see the notes about startArc and endArc. Any floating-point numbers will first be converted to integers (see INT). If any value is out-of-range (see above) an ILLEGAL QUANTITY ERROR is generated. If no bitmap has been setup (see GRAPHIC), a NO GRAPHICS AREA is generated. Example of optional colorSource and optional center:
Example of relative rectangular and polar coordinate:
Example of very wide and very tall ellipse:
Example of an arc (semi-circle), the "bottom half" of an ellipse:
Example of a rotated ellipse:
Example of polygons:
© H2Obsession, 2014 |