Category : Forth Source Code
Archive   : SMILY46H.ZIP
Filename : ELLIP.HLP

 
Output of file : ELLIP.HLP contained in archive : SMILY46H.ZIP
\ ELLIP.HLP Drawing and filling Ellipses and Circles 03Feb89mds

\ First load VGA.SEQ and DMATH.SEQ
\ See TUNNEL.SEQ for a demo.
\ (load VGA.SEQ, GRAPHSAV.SEQ, DMATH.SEQ, and ELLIP.SEQ first)

Address comments and corrections to:
ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»
º Dr. Mark Smiley º
º Department of Mathematics/CS º
º Goucher College º
º Towson, MD 21204 º
ÇÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄĶ
º (410)-337-6285 (W) º
ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ

Reference: "Programmer's Guide to PC & PS/2 Video Systems,"
by Richard Wilton, Microsoft Press, 1987, pages 230-232.


This file contains routines to both draw and fill ellipses.
These words should work in CGA, EGA, and VGA resolutions.
The main words to invoke (after entering a graphics mode) are:
ELLIPSE ( xc yc a0 b0 -- ) ( n1 n2 n3 n4 -- )
FILL_ELLIPSE ( xc yc a0 b0 -- ) ( n1 n2 n3 n4 -- ).
and
CLIP_FILL_ELLIPSE ( xc yc a0 b0 -- ) ( n1 n2 n3 n4 -- ).

In all cases, xc and yc are the coordinates of the center of the
ellipse (in screen coordinates), a0 is the pixel length from the center
of the ellipse to the rightmost point on the ellipse (half the length
of the axis parallel to the x-axis), while b0 is half the length of the
ellipse's axis that is parallel to the y-axis.
...
. ³ .
. b0³ .
. ÀÄÄÄÄ
. a0
...

To draw a circle of radius r centered at (x,y), use:
RES \ to enter graphics mode (optional)
SET_ASPECT \ to set the correct aspect ratio
CIRCLE ( x y r -- ) ( n1 n2 n3 -- ) \ to draw the circle
or
FILL_CIRCLE ( x y r -- ) ( n1 n2 n3 -- ) \ to fill a circle
or
CLIP_FILL_CIRCLE ( x y r -- ) \ to fill a circle with clipping

Don't forget to run SET_ASPECT after entering a new resolution, or
the circles CIRCLE, FILL_CIRCLE and CLIP_FILL_CIRCLE draw will seem
elliptical.

CLIPPING WARNING:
Only the CLIPping routines perform any clipping. The others all assume
the coordinates given are within the range of the current resolution.
Invalid coordinates will have unpredictable effects.

NOTES ON SPEED:
All routines here work in all supported resolutions, but at the
expense of some speed. Hand-coded routines for each resolution
should speed things by about a factor of three. Speed is
particularly critical in the FILL_ELIPSE routine.
Since ELLIPSE, FILL_ELLIPSE, CLIP_FILL_ELLIPSE, CIRCLE, FILL_CIRCLE,
and CLIP_FILL_CIRCLE all set the deferred word ELLIPSE_PIXELS, a routine
which draws a number of one of these will be faster if it sets the word's
value once, then calls (ELLIPSE) or (CIRCLE).

See TUNNEL.SEQ for a demo.



ELLIPSE ( xc yc a0 b0 -- ) ( n1 n2 n3 n4 -- )
Draws an ellipse in the current graphics resolution, where xc and yc are
the coordinates of the center of the ellipse (in screen coordinates), a0
is the pixel length from the center of the ellipse to the rightmost point
on the ellipse (half the length of the axis parallel to the x-axis),
and b0 is half the length of the ellipse's axis that is parallel to the
y-axis. See the diagram below. Uses the color in the variable COLOR.
...
. ³ .
. b0³ .
. ÀÄÄÄÄ
. a0
...

FILL_ELLIPSE ( xc yc a0 b0 -- ) ( n1 n2 n3 n4 -- ).
Draws and fills an ellipse in the current graphics resolution, where xc
and yc are the coordinates of the center of the ellipse (in screen
coordinates), a0 is the pixel length from the center of the ellipse to
the rightmost point on the ellipse (half the length of the axis parallel
to the x-axis), and b0 is half the length of the ellipse's axis that is
parallel to the y-axis. See the diagram below. Uses the color in the
variable COLOR.
...
. ³ .
. b0³ .
. ÀÄÄÄÄ
. a0
...

CLIP_FILL_ELLIPSE ( xc yc a0 b0 -- ) ( n1 n2 n3 n4 -- ).
Draws and fills an ellipse with clipping to assure that no point is
plotted outside the current resolution of the screen. It draws the
ellipse in the current graphics resolution, where xc and yc are the
coordinates of the center of the ellipse (in screen coordinates), a0 is
the pixel length from the center of the ellipse to the rightmost point on
the ellipse (half the length of the axis parallel to the x-axis), and b0
is half the length of the ellipse's axis that is parallel to the y-axis.
See the diagram below. Uses the color in the variable COLOR.
...
. ³ .
. b0³ .
. ÀÄÄÄÄ
. a0
...


SET_ASPECT ( -- )
sets the correct aspect ratio, depending on the current resolution.
Necessary for all circle routines.
Try: RES SET_ASPECT 100 50 20 CIRCLE
Don't forget to run SET_ASPECT after entering a new resolution, or
the circles CIRCLE, FILL_CIRCLE and CLIP_FILL_CIRCLE draw will seem
elliptical.

CIRCLE ( x y r -- ) ( n1 n2 n3 -- )
draws a circle centered at screen coordinates (x,y), of pixel
"radius" r, where r has been normalized to appear round in the
current graphics resolution. Be sure to run SET_ASPECT after
entering a new resolution, or the circles CIRCLE draws will seem
elliptical. Uses the color in the variable COLOR.

FILL_CIRCLE ( x y r -- ) ( n1 n2 n3 -- )
draws and fills a circle centered at screen coordinates (x,y), of pixel
"radius" r, where r has been normalized to appear round in the current
graphics resolution. Be sure to run SET_ASPECT after entering a new
resolution, or the circles FILL_CIRCLE draws will seem elliptical. Uses
the color in the variable COLOR.

CLIP_FILL_CIRCLE ( x y r -- ) \ to fill a circle with clipping
is like FILL_CIRCLE, but it performs clipping on the entire disk, one
line at a time. Otherwise, it also draws and fills a circle centered at
screen coordinates (x,y), of pixel "radius" r, where r has been
normalized to appear round in the current graphics resolution. Be sure
to run SET_ASPECT after entering a new resolution, or the circles
CLIP_FILL_CIRCLE draws will seem elliptical. Uses the color in the
variable COLOR.




  3 Responses to “Category : Forth Source Code
Archive   : SMILY46H.ZIP
Filename : ELLIP.HLP

  1. Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

  2. This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

  3. But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/