home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / World_Of_Computer_Software-02-386-Vol-2of3.iso / b / baswiz19.zip / BW$BAS.ZIP / GN4POLY.BAS < prev    next >
BASIC Source File  |  1993-01-29  |  1KB  |  31 lines

  1. '   +----------------------------------------------------------------------+
  2. '   |                                                                      |
  3. '   |        BASWIZ  Copyright (c) 1990-1993  Thomas G. Hanlin III         |
  4. '   |                                                                      |
  5. '   |                      The BASIC Wizard's Library                      |
  6. '   |                                                                      |
  7. '   +----------------------------------------------------------------------+
  8.  
  9.    DECLARE SUB GN4Line (BYVAL X1%, BYVAL Y1%, BYVAL X2%, BYVAL Y2%)
  10.  
  11.    DEFINT A-Z
  12.  
  13. SUB GN4Polygon (X, Y, Radius, Vertices, Angle!)
  14.    IF Vertices > 1 THEN
  15.       ang! = 6.283185
  16.       dang! = -Angle!
  17.       r! = Radius
  18.       delta! = ang! / CSNG(Vertices)
  19.       x1 = r! * COS(ang! + dang!) * 1.2 + x
  20.       y1 = r! * SIN(ang! + dang!) + y
  21.       FOR DrawLine = 1 TO vertices
  22.          ang! = ang! - delta!
  23.          x2 = r! * COS(ang! + dang!) * 1.2 + x
  24.          y2 = r! * SIN(ang! + dang!) + y
  25.          GN4Line x1, y1, x2, y2
  26.          x1 = x2
  27.          y1 = y2
  28.       NEXT
  29.    END IF
  30. END SUB
  31.