summaryrefslogtreecommitdiff
path: root/ipl/gprogs/design2.icn
diff options
context:
space:
mode:
authorIgor Pashev <pashev.igor@gmail.com>2013-01-27 23:51:56 +0000
committerIgor Pashev <pashev.igor@gmail.com>2013-01-27 23:51:56 +0000
commit6ab0c0f5bf14ed9c15370407b9ee7e0b4b089ae1 (patch)
tree926065cf45450116098db664e3c61dced9e1f21a /ipl/gprogs/design2.icn
downloadicon-6ab0c0f5bf14ed9c15370407b9ee7e0b4b089ae1.tar.gz
Initial upstream version 9.4.3upstream/9.4.3
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