* *
*
* * News
 • Daily news
 • Archived news

Columns
 • WildCard
 • Qbasic Articles
 • QB Comic!

Learning center
 • QB Books
 • Qbasic Lessons!
 • Qbasic FAQ
 • Newbies Section
 • Qbasic Tutorials

* *
*
*
*
*  
.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
 
* * ** * * * *