<dance name="Flowers of Edinburgh">

	<abc>
M:4/4
L:1/8
K:G
GE|D2DE G2GA|BGBd cBAG|FGFE DEFG|AFdF E2GE|
D2DE G2GA|BGBd efge|dcBA GFGA|B2 G2 G2:|]
d2|g2g2 gbag|f2f2 fagf|edef gfed|B2e2 e2ge|
dBGB d2 d2|edef g2fe|dcBA GFGA|B2 G2 G2:|]
	</abc>

	<define_person name="man1"   place="100, -100" facing="90" gender="male"/>
	<define_person name="man2"   place="200, -100" facing="90" gender="male"/>
	<define_person name="man3"   place="300, -100" facing="90" gender="male"/>
	<define_person name="man4"   place="400, -100" facing="90" gender="male"/>
	<define_person name="woman1" place="100, 100"  facing="270" gender="female"/>
	<define_person name="woman2" place="200, 100"  facing="270" gender="female"/>
	<define_person name="woman3" place="300, 100"  facing="270" gender="female"/>
	<define_person name="woman4" place="400, 100"  facing="270" gender="female"/>

	<figure name="Flowers of Edinburgh chase" participants="man1,woman1"/>

	<wait participants="man1,woman1" step="set" bar="9"/>

	<figure name="Flowers of Edinburgh chase" participants="woman1,man1"/>

	<wait participants="man1,woman1" step="set" bar="17"/>

	<figure name="lead down and back" participants="man1,woman1"/>

	<wait participants="man2,woman2" bar="25"/>

	<transition participants="man1,woman1" before="1" type="moving"/>
	<transition participants="man2,woman2" before="1"/>

	<figure name="pousette" participants="man1,woman1,man2,woman2"/>

	<define_figure name="Flowers of Edinburgh chase" bars="6">
		<define_person name="chaser" place="100, -100" facing="90"/>		
		<define_person name="teaser" place="100, 100" facing="270"/>

		<feet person="chaser" step="skip change" bars="6"/>
		<feet person="teaser" step="skip change" bars="6"/>

		<move person="teaser" place="100, 200" direction="0"/>
		<move person="teaser" place="300, 200" direction="0"/>
		<move person="teaser" place="350, 100" direction="270"/>
		<move person="teaser" place="350, -100" direction="270"/>
		<move person="teaser" place="300, -200" direction="180"/>
		<move person="teaser" place="150, -200" direction="180"/>
		<move person="teaser" place="100, -100" direction="90" bar="7"/>

		<move person="chaser" place="100, 100" direction="90"/>
		<move person="chaser" place="150, 200" direction="0"/>
		<move person="chaser" place="300, 200" direction="0"/>
		<move person="chaser" place="350, 100" direction="270"/>
		<move person="chaser" place="250, 0" direction="180"/>
		<move person="chaser" place="150, 0" direction="180"/>
		<move person="chaser" place="50, 100" direction="90"/>
		<move person="chaser" place="100, 100" direction="270" bar="7"/>
	</define_figure>

	<!-- ****************************************************************************
	*
	*  We have a problem to solve.  We give the route for the couple to dance in and
	*  curve down to dance down together.  We do not specify when they transition from
	*  the dancing in phase to the dancing down phase, and nor do we want to.  The
	*  animator should work out a time that gives a smooth transition, a constant speed.
	*  But how, then, do we specify when hands are to be taken?
	*  The answer is that <move> covers a period of time, whereas <hand_hold> is something
	*  that happens at a single point of time.  The <hand_hold> element involves both
	*  "man" and "woman" and so, by definition, will not happen until all prior moves
	*  by "man" and "woman" have completed.  The <checkpoint> element says that both
	*  "man" and "woman" must get to the transition point at the same time without having
	*  to say when that time is.  This makes things a little tricky for animators as
	*  the speed of each person cannot be optimised individually - they must be optimised
	*  together.  One may have to accelerate a little at the transition and the other
	*  may have to decelerate at the transition. 
	*  The second <checkpoint> means all of "man", "Woman" and "hands" must get to their
	*  designated points at the same time, but without the need to specify when that time is.
	*
	*
	*  The time at which the hand hold starts is the time that the hands should
	*  actually be holding.  In practice that means the dancers must start reaching
	*  out their hands prior to that time.  The time at which the dancers start
	*  reaching out their hands is a matter of interpretation and is not defined
	*  in the dance definition.  An animation program may hard code a fixed time for this,
	*  or may base it on, for example, how far the hand hold position is from the dancer.
	*
	********************************************************************************* -->

	<define_figure name="lead down and back" bars="8">
		<define_person name="man" place="100, -100" facing="90"/>		
		<define_person name="woman" place="100, 100" facing="270"/>

		<hand_hold bars="8">
			<hand person="man" which="right"/>
			<hand person="woman" which="right"/>
		</hand_hold>	

		<move person="man" place="200, -20" direction="0"/>
		<move person="woman" place="200, 20" direction="0"/>

		<move person="man" place="500, -20" direction="0" bar="4.5"/>
		<move person="woman" place="500, 20" direction="0" bar="4.5"/>

		<rotate person="man" facing="180" turn="180" bar="5.5"/>
		<rotate person="woman" facing="180" turn="-180" bar="5.5"/>

		<move person="man" place="200, -20" direction="180"/>
		<move person="woman" place="200, 20" direction="180"/>

		<move person="man" place="100, -100" direction="90" bar="9"/>
		<move person="woman" place="100, 100" direction="270" bar="9"/>
	
	</define_figure>

	<!-- ****************************************************************************
	*  The definition of this figure demonstrate the use of an 'unit'.
	*  An unit is a group of two or more people that act as a unit.
	*  Having defined the unit (which people are in it, where they are relative
	*  to each other and where their hands are) we can then move the unit around
	*  in exactly the same way that we move a person around.		
	*  
	*  In this definition of a pousette we define two units, "couple1" and "couple2"
	*  When we define the unit, we say who is in it and the type of unit.
	*  In this case the type of the unit is "two hand hold".  This unit type is
	*  defined later in the define_unit_type element below.
	*
	*  If you look at the definition of "two hand hold", you will see that the
	*  co-ordinates of the unit is the co-ordinates of the point midway between
	*  the man and the woman.  You will also see that the man is facing in the same
	*  direction as the unit and the woman is facing 180 degrees opposite to the
	*  direction in which the unit is facing.  Therefore when moving the unit around,
	*  make the item face in the direction that you want the man to face.
	*  (You could just as easily make the direction in which the unit is facing
	*  be the direction the woman is facing by modifying the definition of "two hand hold"
	*  and reversing the direction in which the unit is facing when moving the unit
	*  around). 
	*
	********************************************************************************* -->

	<define_figure name="pousette">
		<define_person name="man1"/>		
		<define_person name="woman1"/>
		<define_person name="man2"/>		
		<define_person name="woman2"/>

		<form_unit name="couple1" participants="man1,woman1" type="two hand hold" place="100, 0" facing="90" bar="1"/>
		<form_unit name="couple2" participants="man2,woman2" type="two hand hold" place="200, 0" facing="90" bar="1"/>

		<action person="man1" step="bar de basque (left foot)" bars="6"/>
		<action person="woman1" step="bar de basque (right foot)" bars="6"/>
		<action person="man2" step="bar de basque (right foot)" bars="6"/>
		<action person="woman2" step="bar de basque (left foot)" bars="6"/>

		<shift  person="couple1" place="100, -50"               bar="2"/> 
		<rotate person="couple1"                   facing="0"   bar="3"/> 
		<shift  person="couple1" place="200, -50"               bar="4"/> 
		<rotate person="couple1"                   facing="270" bar="5"/> 
		<shift  person="couple1" place="200, 0"                 bar="6"/> 
		<rotate person="couple1" turn="-180"       facing="90"  bar="7"/> 

		<shift  person="couple2" place="200, 50"                bar="2"/> 
		<rotate person="couple2"                   facing="0"   bar="3"/> 
		<shift  person="couple2" place="100, 50"                bar="4"/> 
		<rotate person="couple2"                   facing="270" bar="5"/> 
		<shift  person="couple2" place="100, 0"                 bar="6"/> 
		<rotate person="couple2" turn="-180"       facing="90"  bar="7"/> 

		<disband_unit name="couple1" bar="8"/>
		<disband_unit name="couple2" bar="8"/>

		<shift  person="man1"    place="200, -100"              bar="9"/> 
		<shift  person="woman1"  place="200, 100"               bar="9"/> 
	
		<shift  person="man2"    place="100, -100"              bar="9"/> 
		<shift  person="woman2"  place="100, 100"               bar="9"/> 
	</define_figure>

	<define_unit_type name="two hand hold">
		<define_person name="man" place="-20, 0" facing="0"/>		
		<define_person name="woman" place="20, 0" facing="180"/>

		<hand_hold place="0, 20">
			<hand person="man" which="left"/>
			<hand person="woman" which="right"/>
		</hand_hold>	

		<hand_hold place="0, -20">
			<hand person="man" which="right"/>
			<hand person="woman" which="left"/>
		</hand_hold>	
	</define_unit_type>

</dance>