summaryrefslogtreecommitdiff
path: root/ipl/gprogs/design2.icn
diff options
context:
space:
mode:
Diffstat (limited to 'ipl/gprogs/design2.icn')
-rw-r--r--ipl/gprogs/design2.icn62
1 files changed, 62 insertions, 0 deletions
diff --git a/ipl/gprogs/design2.icn b/ipl/gprogs/design2.icn
new file mode 100644
index 0000000..8ee72ac
--- /dev/null
+++ b/ipl/gprogs/design2.icn
@@ -0,0 +1,62 @@
+############################################################################
+#
+# File: design2.icn
+#
+# Subject: Program to draw circular design
+#
+# Author: Ralph E. Griswold
+#
+# Date: February 17, 1995
+#
+############################################################################
+#
+# This file is in the public domain.
+#
+############################################################################
+#
+# This program draws a design in which i points around a circle are
+# all connected to each other. The number of points is given as
+# a command-line argument (default 20). Values larger than 30 produce
+# results that are too dense to be interesting.
+#
+############################################################################
+#
+# Requires: Version 9 graphics
+#
+############################################################################
+#
+# Links: gobject, joinpair, wopen
+#
+############################################################################
+
+link gobject
+link joinpair
+link wopen
+
+procedure main(argl)
+ local i, j, k, angle, incr, size, radius, xc, yc, points
+
+ i := integer(argl[1]) | 20
+
+ size := 300
+ radius := size / 2
+ xc := yc := size / 2
+
+ WOpen("label=mandala", "width=" || size, "height=" || size) |
+ stop("*** cannot open window")
+
+ points := list(i)
+
+ angle := 0.0
+ incr := 2 * &pi / i
+
+ every j := 1 to i do {
+ points[j] := Point(xc + radius * cos(angle), yc + radius * sin(angle))
+ angle +:= incr
+ }
+
+ joinpair(points, points)
+
+ Event()
+
+end