/* -*- Mode: C; tab-width: 4 -*-
* penrose --- quasiperiodic tilings.
*/
+
+/* As reported in News of the Weird:
+
+ In April, Sir Roger Penrose, a British math professor who has worked
+ with Stephen Hawking on such topics as relativity, black holes, and
+ whether time has a beginning, filed a copyright-infringement lawsuit
+ against the Kimberly-Clark Corporation, which Penrose said copied a
+ pattern he created (a pattern demonstrating that "a nonrepeating
+ pattern could exist in nature") for its Kleenex quilted toilet paper.
+ Penrose said he doesn't like litigation but, "When it comes to the
+ population of Great Britain being invited by a multinational to wipe
+ their bottoms on what appears to be the work of a Knight of the
+ Realm, then a last stand must be taken."
+
+ NOTW #491, 4-jul-1997, by Chuck Shepherd.
+ http://www.nine.org/notw/notw.html
+ */
+
+
#if !defined( lint ) && !defined( SABER )
static const char sccsid[] = "@(#)penrose.c 4.00 97/01/01 xlockmore";
#endif
* other special, indirect and consequential damages.
*
* Revision History:
- * 10-May-97: jwz@netscape.com: turned into a standalone program.
- * 09-Sep-96: Written.
- */
+ * 10-May-97: jwz@jwz.org: turned into a standalone program.
+ * 09-Sep-96: Written. */
/*-
Be careful, this probably still has a few bugs (many of which may only
* vertex rules only allow at most seven tiles to meet at a vertex.
*/
-#define CELEBRATE 31415927 /* This causes a pause, an error occurred. */
-#define COMPLETION 3141593 /* This causes a pause, an error occurred. */
-
#define MAX_TILES_PER_VERTEX 7
#define N_VERTEX_RULES 8
#define ALLOC_NODE( type) ((type *)malloc( sizeof( type)))
static Bool ammann;
+/* How long in seconds should we wait before starting a new tiling? */
+static long redo_delay = 3;
+static long redo_delay_usec;
+
static XrmOptionDescRec opts[] =
{
{"-ammann", ".penrose.ammann", XrmoptionNoArg, (caddr_t) "on"},
- {"+ammann", ".penrose.ammann", XrmoptionNoArg, (caddr_t) "off"}
+ {"+ammann", ".penrose.ammann", XrmoptionNoArg, (caddr_t) "off"},
+ {"-redoDelay", ".penrose.redoDelay", XrmoptionSepArg, NULL}
};
static argtype vars[] =
{
- {(caddr_t *) & ammann, "ammann", "Ammann", DEF_AMMANN, t_Bool}
+ {(caddr_t *) & ammann, "ammann", "Ammann", DEF_AMMANN, t_Bool},
+ {(caddr_t *) & redo_delay, "redoDelay", "RedoDelay", "3", t_Int}
};
static OptionStruct desc[] =
{
- {"-/+ammann", "turn on/off Ammann lines"}
+ {"-/+ammann", "turn on/off Ammann lines"},
+ {"-redoDelay", "delay between new tilings"}
};
-ModeSpecOpt penrose_opts = { 2, opts, 1, vars, desc };
+ModeSpecOpt penrose_opts = { 3, opts, 2, vars, desc };
/*-
(void) fprintf(stderr, "v2->fived[%d]=%d, vertex->fived[%d]=%d\n",
i, v2->fived[i], i, vertex->fived[i]);
}
- MI_PAUSE(mi) = CELEBRATE;
+ MI_PAUSE(mi) = redo_delay_usec;
return 0;
}
fringe_node_c *fp;
int i, size;
+ redo_delay_usec = redo_delay * 1000000;
+
if (tilings == NULL) {
if ((tilings = (tiling_c *) calloc(MI_NUM_SCREENS(mi),
sizeof (tiling_c))) == NULL)
if (MI_WIN_IS_VERBOSE(mi)) {
(void) fprintf(stderr, "Dislocation occured!\n");
}
- MI_PAUSE(mi) = CELEBRATE; /* Should be able to recover */
+ MI_PAUSE(mi) = redo_delay_usec; /* Should be able to recover */
}
if (1 == find_completions(vertex, hits, n_hits, S_LEFT, 0 /*, False */ ))
forced_sides |= S_LEFT;
(void) fprintf(stderr, "Weirdness in delete_penrose()\n");
(void) fprintf(stderr, "tp->fringe.nodes == vertex\n");
}
- MI_PAUSE(mi) = CELEBRATE;
+ MI_PAUSE(mi) = redo_delay_usec;
}
if (vertex->list_ptr != 0) {
forced_node_c *node = *vertex->list_ptr;
(void) fprintf(stderr, "Weirdness in alloc_vertex()\n");
(void) fprintf(stderr, "v = 0\n");
}
- MI_PAUSE(mi) = CELEBRATE;
+ MI_PAUSE(mi) = redo_delay_usec;
}
*v = *from;
add_unit_vec(dir, v->fived);
} while (node != tp->fringe.nodes);
/* Rechain. */
- if (!(fc & FC_CUT_THIS))
+ if (!(fc & FC_CUT_THIS)) {
if (side == S_LEFT) {
vertex->next = right;
right->prev = vertex;
vertex->prev = left;
left->next = vertex;
}
+ }
if (!(fc & FC_CUT_FAR)) {
if (!(fc & FC_CUT_LEFT)) {
far->next = left;
/* No visible nodes left. */
if (tp->fringe.n_nodes == 0) {
tp->done = True;
- MI_PAUSE(mi) = COMPLETION; /* Just finished drawing */
+ MI_PAUSE(mi) = redo_delay_usec; /* Just finished drawing */
return;
}
if (tp->forced.n_visible > 0 && tp->failures < 10) {