Curve;

//*********************************************************************************************
// Do the arrow head at the end.

dAngle2 = Arctangent(c2y-e2y,c2x-e2x);

// 45 degrees is .7853981
dAngle5 = dAngle2 -.7853981;
d5 = 1.414grid;
dAngle6 = Arctangent(1,2);

dAngle8 = dAngle2 -dAngle6;
d8 = 1.1180*grid;
x8 = LengthTimesCosine(d8,dAngle8);
y8 = LengthTimesSine(d8,dAngle8);
MoveTo(e2x +x8,e2y +y8);

dAngle7 = dAngle5;
d7 = 1.414*grid;
x7 = LengthTimesCosine(d7,dAngle7);
y7 = LengthTimesSine(d7,dAngle7);
LineTo(e2x +x7,e2y +y7);
LineTo(e2x,e2y);


dAngle7 = dAngle2 +.7853981;
d7 = 1.414*grid;
x7 = LengthTimesCosine(d7,dAngle7);
y7 = LengthTimesSine(d7,dAngle7);
LineTo(e2x +x7,e2y +y7);

dAngle9 = dAngle2 +dAngle6;
d9 = 1.1180*grid;
x9 = LengthTimesCosine(d9,dAngle9);
y9 = LengthTimesSine(d9,dAngle9);
LineTo(e2x +x9,e2y +y9);

//*********************************************************************************************

// Compose the top curve.
// Form the x,y offsets for the starting point e1, and the control point c1.
dAngle4 = Arctangent(c1y-e1y,c1x-e1x);
dAngle1 = dAngle4 +3.1415/2;

dAngle0 = dAngle4 -3.1415/2;

d0 = grid/2;
d1 = grid/2;
x0 = LengthTimesCosine(d0,dAngle0);
y0 = LengthTimesSine(d0,dAngle0);
x1 = LengthTimesCosine(d1,dAngle1);
y1 = LengthTimesSine(d1,dAngle1);

// The upper curve must be drawn 1/2 grid point higher so they don't touch.
d2 = grid/2;
x2 = LengthTimesCosine(d2,dAngle2);
y2 = LengthTimesSine(d2,dAngle2);

d4=grid/2;
x4 = LengthTimesCosine(d4,dAngle4);
y4 = LengthTimesSine(d4,dAngle4);

// Form the x,y offsets for the ending point e2 and control point c2

// Draw the top curve of the set.

//BezierCurve(c1x+x1+x0,c1y+y1+y0,c2x+x2+x3,c2y+y2+y3,e1x+x1,e1y+y1,e2x+x8,e2y+y8,16);

BezierCurve(c1x+x1+x4,c1y+y1+y4,c2x+x8 +x2,c2y+y8 +y2,e1x+x1,e1y+y1,e2x+x8,e2y+y8,16);

//**********************************************************************************************
// Compose the bottom curve.

// Draw the bottom curve of the set.

// The lower grid must be drawn 1/2 grid point lower. 
d2 = grid/2;
dAngle2 = dAngle2 +3.1415;
x2 = LengthTimesCosine(d2,dAngle2);
y2 = LengthTimesSine(d2,dAngle2);

d4=grid/2;
dAngle4 = dAngle4 +3.1415;
x4 = LengthTimesCosine(d4,dAngle4);
y4 = LengthTimesSine(d4,dAngle4);

//BezierCurve(c1x+x1+x0,c1y+y1+y0,c2x+x2+x3,c2y+y2+y3,e1x+x1,e1y+y1,e2x+x9,e2y+y9,16);
BezierCurve(c1x+x0 +x4,c1y+y0 +y4,c2x+x9 +x2,c2y+y9 +y2,e1x+x0,e1y+y0,e2x+x9,e2y+y9,16);

//**********************************************************************************************
// Draw the cross bar at the start of the curve.
MoveTo(e1x +x0,e1y +y0);
LineTo(e1x +x1,e1y +y1);

 