home *** CD-ROM | disk | FTP | other *** search
/ ftp.cs.arizona.edu / ftp.cs.arizona.edu.tar / ftp.cs.arizona.edu / icon / historic / v941.tgz / icon.v941src.tar / icon.v941src / ipl / gprocs / rstars.icn < prev    next >
Text File  |  2000-07-29  |  1KB  |  59 lines

  1. ############################################################################
  2. #
  3. #    File:     rstars.icn
  4. #
  5. #    Subject:  Procedure to generate traces of regular stars
  6. #
  7. #    Author:   Ralph E. Griswold
  8. #
  9. #    Date:     March 27, 1993
  10. #
  11. ############################################################################
  12. #
  13. #   This file is in the public domain.
  14. #
  15. ############################################################################
  16. #
  17. #  This procedure generates traces of regular stars.
  18. #
  19. ############################################################################
  20. #
  21. #  Links:  gobject
  22. #
  23. ############################################################################
  24.  
  25. link gobject
  26.  
  27. global size
  28.  
  29. #
  30. #  Generate points on regular star with n vertices, jumping j vertices,
  31. #  centered at x and y, with scaled radius, with an initial offset angle,
  32. #  and with a specified frame size.
  33.  
  34. procedure rstar(x, y, n, j, scale, offset, size)    #:  regular star
  35.    local i, jangle, angle
  36.  
  37.    /x := 100                # defaults
  38.    /y := 100 
  39.    /n := 5
  40.    /j := 3
  41.    /scale := 0.45
  42.    /offset := 0.5
  43.    /size := 200
  44.  
  45.    jangle := j * 2 * &pi / n
  46.  
  47.    scale *:= size
  48.    offset *:= &pi
  49.  
  50.    every i := 0 to n do {
  51.       angle := jangle * i + offset
  52.       suspend Point(
  53.           x + scale * cos(angle),
  54.           y + scale * sin(angle)
  55.          )
  56.       }
  57.  
  58. end
  59.