diff options
Diffstat (limited to 'ipl/gprocs/xform.icn')
-rw-r--r-- | ipl/gprocs/xform.icn | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/ipl/gprocs/xform.icn b/ipl/gprocs/xform.icn new file mode 100644 index 0000000..6377c3a --- /dev/null +++ b/ipl/gprocs/xform.icn @@ -0,0 +1,60 @@ +############################################################################ +# +# File: xform.icn +# +# Subject: Procedures to transform points +# +# Author: Ralph E. Griswold +# +# Date: October 1, 1997 +# +############################################################################ +# +# This file is in the public domain. +# +############################################################################ +# +# This file contains procedures that manipulate points representing +# vertices. +# +############################################################################ +# +# Links: calls, gobject +# +############################################################################ + +link calls, gobject + +procedure p_xlate(call, x, y) + local point + + every point := invoke(call) do { + point.x +:= x + point.y +:= y + suspend point + } + +end + +procedure p_scale(call, factor) + local point + + every point := invoke(call) do { + point.x *:= factor + point.y *:= factor + suspend point + } + +end + +procedure p_rotate(call, angle) + local point, radius + + every point := invoke(call) do { + radius := sqrt(point.x ^ 2, point.y ^ 2) + point.x *:= radius * cos(angle) + point.y *:= radius * sin(angle) + suspend point + } + +end |