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 / xform.icn < prev    next >
Text File  |  2000-07-29  |  1KB  |  61 lines

  1. ############################################################################
  2. #
  3. #    File:     xform.icn
  4. #
  5. #    Subject:  Procedures to transform points
  6. #
  7. #    Author:   Ralph E. Griswold
  8. #
  9. #    Date:     October 1, 1997
  10. #
  11. ############################################################################
  12. #
  13. #  This file is in the public domain.
  14. #
  15. ############################################################################
  16. #
  17. #  This file contains procedures that manipulate points representing
  18. #  vertices. 
  19. #
  20. ############################################################################
  21. #
  22. #  Links:  calls, gobject
  23. #
  24. ############################################################################
  25.  
  26. link calls, gobject
  27.  
  28. procedure p_xlate(call, x, y)
  29.    local point
  30.  
  31.    every point := invoke(call) do {
  32.       point.x +:= x
  33.       point.y +:= y
  34.       suspend point
  35.       }
  36.  
  37. end
  38.  
  39. procedure p_scale(call, factor)
  40.    local point
  41.  
  42.    every point := invoke(call) do {
  43.       point.x *:= factor
  44.       point.y *:= factor
  45.       suspend point
  46.       }
  47.  
  48. end
  49.  
  50. procedure p_rotate(call, angle)
  51.    local point, radius
  52.  
  53.    every point := invoke(call) do {
  54.       radius := sqrt(point.x ^ 2, point.y ^ 2)
  55.       point.x *:= radius * cos(angle)
  56.       point.y *:= radius * sin(angle)
  57.       suspend point
  58.       }
  59.  
  60. end
  61.