qb45advr.hlp (Topic list)
Important Notice
The pages on this site contain documentation for very old MS-DOS software, purely for historical purposes. If you're looking for up-to-date documentation, particularly for programming, you should not rely on the information found here, as it will be woefully out of date.
POINT Function Programming Example
  QuickSCREEN      Details     Example      Contents      Index
──────────────────────────────────────────────────────────────────────────────
POINT Function Programming Example
 
This example redraws an ellipse drawn with the CIRCLE statement, using
POINT to find the border of the ellipse by testing for a change in
color:
 
DEFINT X, Y
INPUT "Enter angle of tilt in degrees (0 to 90): ",Ang
SCREEN 1         'Medium resolution screen.
Ang = (3.1415926# / 180) * Ang      'Convert degrees to radians.
Cs = COS(Ang) : Sn = SIN(Ang)
CIRCLE (45, 70), 50, 2, , , 2       'Draw ellipse.
PAINT (45, 70), 2                   'Paint interior of ellipse.
FOR Y = 20 TO 120
   FOR X = 20 TO 70
   'Check each point in rectangle enclosing ellipse.
   IF POINT(X, Y) <> 0 THEN
       'If the point is in the ellipse, plot a corresponding
       'point in the "tilted" ellipse.
       Xnew = (X * Cs - Y * Sn) + 200 : Ynew = (X * Sn + Y * Cs)
       PSET(Xnew, Ynew), 2
   END IF
   NEXT
NEXT
END