#!/usr/local/bin/perl
# dihedral - generates a TeXdraw macro for the Cayley graph of D_3
#
# $Id: dihedral,v 1.2 1994/01/28 23:47:22 pliam Exp $

require 'graphtex.pl';

#
# set up %posit array for objects in1..in3, out1..out3
#
$inrad = 8;   # radius of inner pentagon
$outrad = 20; # radius of outer pentagon
$theta = $pi/2;
foreach $i (1..3) {
   $x = $inrad*cos($theta);
   $y = $inrad*sin($theta);
   $posit{"in$i"} = "$x $y";
   $x = $outrad*cos($theta);
   $y = $outrad*sin($theta);
   $posit{"out$i"} = "$x $y";
   $theta += 2*$pi/3;
}

#
# set up connectivity array %connect
#
%connect = (
   'in1', '\ver \to<in2>_{#1} \to<out1>(+)_{#2}',
   'in2', '\ver \to<in3>_{#1} \to<out2>(+)_{#2}',
   'in3', '\ver \to<in1>_{#1} \to<out3>(+)_{#2}',
   'out1', '\ver \to<in1>(+)_{#2} \gtset{\bezfact}{1.0} \to<out3>(+)_{#1}',
   'out2', '\ver \to<in2>(+)_{#2} \gtset{\bezfact}{1.0} \to<out1>(+)_{#1}',
   'out3', '\ver \to<in3>(+)_{#2} \gtset{\bezfact}{1.0} \to<out2>(+)_{#1}',
);

#
# print the macro to standard out
#
open(OUT, ">&STDOUT");
print OUT "\\newcommand{\\dihedral}[2]{\n";
&parse;
print OUT "}\n";
