############################################################################ # # 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