summaryrefslogtreecommitdiff
path: root/ipl/gprocs/rstars.icn
diff options
context:
space:
mode:
Diffstat (limited to 'ipl/gprocs/rstars.icn')
-rw-r--r--ipl/gprocs/rstars.icn58
1 files changed, 58 insertions, 0 deletions
diff --git a/ipl/gprocs/rstars.icn b/ipl/gprocs/rstars.icn
new file mode 100644
index 0000000..3372f2a
--- /dev/null
+++ b/ipl/gprocs/rstars.icn
@@ -0,0 +1,58 @@
+############################################################################
+#
+# File: rstars.icn
+#
+# Subject: Procedure to generate traces of regular stars
+#
+# Author: Ralph E. Griswold
+#
+# Date: March 27, 1993
+#
+############################################################################
+#
+# This file is in the public domain.
+#
+############################################################################
+#
+# This procedure generates traces of regular stars.
+#
+############################################################################
+#
+# Links: gobject
+#
+############################################################################
+
+link gobject
+
+global size
+
+#
+# Generate points on regular star with n vertices, jumping j vertices,
+# centered at x and y, with scaled radius, with an initial offset angle,
+# and with a specified frame size.
+
+procedure rstar(x, y, n, j, scale, offset, size) #: regular star
+ local i, jangle, angle
+
+ /x := 100 # defaults
+ /y := 100
+ /n := 5
+ /j := 3
+ /scale := 0.45
+ /offset := 0.5
+ /size := 200
+
+ jangle := j * 2 * &pi / n
+
+ scale *:= size
+ offset *:= &pi
+
+ every i := 0 to n do {
+ angle := jangle * i + offset
+ suspend Point(
+ x + scale * cos(angle),
+ y + scale * sin(angle)
+ )
+ }
+
+end