DEFINITION  
    output     = "pix/stereo";
    xleft = 0; xright = 323;
    ylow  = 0; yhigh  = 242;
    aalevelmin = 2;  aalevelmax = 4; aawidth = 1; aathreshold = 40;
    up         = yaxis;

    startframe = 1.0;
    endframe   = 70.0;
    byframe    =  1.0;

    stereo            = TRUE;
    stereo_eye_offset = 0.55;

	triple CameraView(0.000000, 0.000000, 0.000000);
    scalar xtarget(0.5);  /* position of the target */
    scalar ytarget(0.3);
    scalar ztarget(0.5);

    scalar xapproach(0);  /* position of the approach vector */
    scalar yapproach(0);
    scalar zapproach(0);

    scalar xorg(0.0);
    scalar yorg(0.0);
    scalar zorg(0.0);

    scalar zangle(0);
    scalar z1(0);
    scalar yangle(0);
    scalar y1(0);
    scalar xzlength(0);
    scalar xwrist(0);
    scalar ywrist(0);
    scalar zwrist(0);
    scalar x1(0);
    scalar totallen2(0);

    scalar segmentlen1(1.0);
    scalar segmentrad1(0.2);
    scalar segmentlen2(1.0);
    scalar segmentrad2(0.15);
    scalar segmentlen3(0.2);
    scalar segmentrad3(0.1);

    scalar reach2(0);
    scalar phi(0);
    scalar length(0);
    scalar dz(0);
    scalar dy(0);
    scalar dx(0);
    scalar dl2(0);
    scalar dl(0);
    scalar dify(0);
    scalar difx(0);
    scalar alpha2(0);
    scalar alpha1(0);
    scalar SinC(0);
    scalar CosC(0);

    shader Red   ( model = lambert, color = (255.0,   0.0,   0.0) );
    shader Green ( model = lambert, color = (  0.0, 255.0,   0.0) );
    shader Yellow( model = lambert, color = (255.0, 255.0,   0.0) );
    shader Cyan  ( model = lambert, color = (  0.0, 255.0, 255.0) );


MODEL

{
    translate(0.000000, 4.000000, 6.000000);
    light (model = ambient, color = (255.0, 255.0, 255.0), ambient_shade = 0 );
}
{
    camera( eye   = (0.000000, 4.000000, 6.000000)
           ,view  = CameraView
           ,twist = 0.000000
           ,fov   = (25.000000),
            viewport = (xleft, xright, ylow, yhigh),
            aspect   = 1280/1024
          );
}

xapproach = (-0.300000 * ((frame - 50.000000) / 50.000000));
yapproach = 0.600000;
zapproach = (0.400000 + (0.200000 * ((frame - 50.000000) / 50.000000)));
totallen2 = ((segmentlen1 + segmentlen2) * (segmentlen1 + segmentlen2));
xwrist = (xtarget + xapproach);
ywrist = (ytarget + yapproach);
zwrist = (ztarget + zapproach);
dx = (xwrist - xorg);
dy = (ywrist - yorg);
dz = (zwrist - zorg);
if ((dx == 0.000000))
{
    phi = -90.000000;
}
else
{
    phi = atan2d( -dz, dx );
}
dl2 = ((dx * dx) + (dz * dz));
dl = sqrt( dl2 );
reach2 = (dl2 + (dy * dy));
if ((reach2 < totallen2))
{
    CosC = ((((segmentlen1 * segmentlen1) + (segmentlen2 * segmentlen2))
           - reach2) / ((2.000000 * segmentlen1) * segmentlen2));
    SinC = sqrt( (1.000000 - (CosC * CosC)) );
    alpha2 = (180.000000 + atan2d( SinC, CosC ));
}
else
{
    alpha2 = 0.000000;
}
dify = (segmentlen1 + (segmentlen2 * cosd( alpha2 )));
difx = (-segmentlen2 * sind( alpha2 ));
alpha1 = atan2d( difx, dify );
alpha1 = (alpha1 + atan2d( dl, -dy ));
{
    translate (xorg, yorg, zorg);
    rotate    ( yaxis, phi);
    rotate    ( zaxis, alpha1);
    {  /*   Start of cylinder   */
/* Define segment1 of the limb */
        scale     (segmentrad1, segmentlen1, segmentrad1);
        translate (0.000000, -0.500000, 0.000000);
        patch( shader = ( Red ),
               doublesided = TRUE,
               subdivide = uniform, divisions = (4, 4),
               udegree = 3, vdegree = 3,
               vclosed = TRUE, 
               uknots = (-2.000000, -1.000000, 0.000000, 1.000000, 2.000000,
                         3.000000),
               vknots = (-0.333333, -0.166667, 0.000000, 0.166667, 0.333333,
                         0.500000, 0.666667, 0.833333, 1.000000, 1.166667,
                         1.333333),
               cvs = ((cv( (-0.300000,  1.500000, -0.519620), 1.000000),
                       cv( (-0.600000,  1.500000,  0.000000), 1.000000),
                       cv( (-0.300000,  1.500000,  0.519620), 1.000000),
                       cv( ( 0.300000,  1.500000,  0.519610), 1.000000),
                       cv( ( 0.600000,  1.500000,  0.000000), 1.000000),
                       cv( ( 0.300000,  1.500000, -0.519620), 1.000000),
                       cv( (-0.300000,  1.500000, -0.519620), 1.000000),
                       cv( (-0.600000,  1.500000,  0.000000), 1.000000),
                       cv( (-0.300000,  1.500000,  0.519620), 1.000000)),
                      (cv( (-0.300000,  0.500000, -0.519620), 1.000000),
                       cv( (-0.600000,  0.500000,  0.000000), 1.000000),
                       cv( (-0.300000,  0.500000,  0.519620), 1.000000),
                       cv( ( 0.300000,  0.500000,  0.519610), 1.000000),
                       cv( ( 0.600000,  0.500000,  0.000000), 1.000000),
                       cv( ( 0.300000,  0.500000, -0.519620), 1.000000),
                       cv( (-0.300000,  0.500000, -0.519620), 1.000000),
                       cv( (-0.600000,  0.500000,  0.000000), 1.000000),
                       cv( (-0.300000,  0.500000,  0.519620), 1.000000)),
                      (cv( (-0.300000, -0.500000, -0.519620), 1.000000),
                       cv( (-0.600000, -0.500000,  0.000000), 1.000000),
                       cv( (-0.300000, -0.500000,  0.519620), 1.000000),
                       cv( ( 0.300000, -0.500000,  0.519610), 1.000000),
                       cv( ( 0.600000, -0.500000,  0.000000), 1.000000),
                       cv( ( 0.300000, -0.500000, -0.519620), 1.000000),
                       cv( (-0.300000, -0.500000, -0.519620), 1.000000),
                       cv( (-0.600000, -0.500000,  0.000000), 1.000000),
                       cv( (-0.300000, -0.500000,  0.519620), 1.000000)),
                      (cv( (-0.300000, -1.500000, -0.519620), 1.000000),
                       cv( (-0.600000, -1.500000,  0.000000), 1.000000),
                       cv( (-0.300000, -1.500000,  0.519620), 1.000000),
                       cv( ( 0.300000, -1.500000,  0.519610), 1.000000),
                       cv( ( 0.600000, -1.500000,  0.000000), 1.000000),
                       cv( ( 0.300000, -1.500000, -0.519620), 1.000000),
                       cv( (-0.300000, -1.500000, -0.519620), 1.000000),
                       cv( (-0.600000, -1.500000,  0.000000), 1.000000),
                       cv( (-0.300000, -1.500000,  0.519620), 1.000000))
                     )
             );
        patch( shader = ( Red ),
               doublesided = TRUE, vclosed = TRUE, 
               subdivide = uniform, divisions = (4, 4),
               udegree = 3, vdegree = 3,
               uknots = (-2.000000, -1.000000, 0.000000, 1.000000, 2.000000,
                         3.000000),
               vknots = (-0.333333, -0.166667, 0.000000, 0.166667, 0.333333,
                         0.500000, 0.666667, 0.833333, 1.000000, 1.166667,
                         1.333333),
               cvs = ((cv( (0.300000, 0.500000, 0.519620), 1.000000),
                       cv( (0.600000, 0.500000, 0.000000), 1.000000),
                       cv( (0.300000, 0.500000, -0.519620), 1.000000),
                       cv( (-0.300000, 0.500000, -0.519610), 1.000000),
                       cv( (-0.600000, 0.500000, 0.000000), 1.000000),
                       cv( (-0.300000, 0.500000, 0.519620), 1.000000),
                       cv( (0.300000, 0.500000, 0.519620), 1.000000),
                       cv( (0.600000, 0.500000, 0.000000), 1.000000),
                       cv( (0.300000, 0.500000, -0.519620), 1.000000)),
                      (cv( (0.000000, 0.500000, 0.000000), 1.000000),
                       cv( (0.000000, 0.500000, 0.000000), 1.000000),
                       cv( (0.000000, 0.500000, 0.000000), 1.000000),
                       cv( (0.000000, 0.500000, 0.000000), 1.000000),
                       cv( (0.000000, 0.500000, 0.000000), 1.000000),
                       cv( (0.000000, 0.500000, 0.000000), 1.000000),
                       cv( (0.000000, 0.500000, 0.000000), 1.000000),
                       cv( (0.000000, 0.500000, 0.000000), 1.000000),
                       cv( (0.000000, 0.500000, 0.000000), 1.000000)),
                      (cv( (-0.300000, 0.500000, -0.519620), 1.000000),
                       cv( (-0.600000, 0.500000, 0.000000), 1.000000),
                       cv( (-0.300000, 0.500000, 0.519620), 1.000000),
                       cv( (0.300000, 0.500000, 0.519610), 1.000000),
                       cv( (0.600000, 0.500000, 0.000000), 1.000000),
                       cv( (0.300000, 0.500000, -0.519620), 1.000000),
                       cv( (-0.300000, 0.500000, -0.519620), 1.000000),
                       cv( (-0.600000, 0.500000, 0.000000), 1.000000),
                       cv( (-0.300000, 0.500000, 0.519620), 1.000000)),
                      (cv( (-0.600000, 0.500000, -1.039230), 1.000000),
                       cv( (-1.200000, 0.500000, 0.000000), 1.000000),
                       cv( (-0.600000, 0.500000, 1.039230), 1.000000),
                       cv( (0.600000, 0.500000, 1.039230), 1.000000),
                       cv( (1.200000, 0.500000, 0.000000), 1.000000),
                       cv( (0.600000, 0.500000, -1.039230), 1.000000),
                       cv( (-0.600000, 0.500000, -1.039230), 1.000000),
                       cv( (-1.200000, 0.500000, 0.000000), 1.000000),
                       cv( (-0.600000, 0.500000, 1.039230), 1.000000))
                     )
             );
    }
    translate (0.000000, -segmentlen1, 0.000000);
    rotate    ( zaxis, alpha2);
    {
/* Define segment 2*/
        scale     (segmentrad2, segmentlen2, segmentrad2);
        translate (0.000000, -0.500000, 0.000000);
        patch( shader = ( Cyan ),
               doublesided = TRUE,
               subdivide = uniform, divisions = (4, 4),
               udegree = 3, vdegree = 3,
               vclosed = TRUE, 
               uknots = (-2.000000, -1.000000, 0.000000, 1.000000, 2.000000,
                          3.000000),
               vknots = (-0.333333, -0.166667, 0.000000, 0.166667, 0.333333,
                          0.500000,  0.666667, 0.833333, 1.000000, 1.166667,
                          1.333333),
               cvs = ((cv( (-0.300000,  1.500000, -0.519620), 1.000000),
                       cv( (-0.600000,  1.500000,  0.000000), 1.000000),
                       cv( (-0.300000,  1.500000,  0.519620), 1.000000),
                       cv( ( 0.300000,  1.500000,  0.519610), 1.000000),
                       cv( ( 0.600000,  1.500000,  0.000000), 1.000000),
                       cv( ( 0.300000,  1.500000, -0.519620), 1.000000),
                       cv( (-0.300000,  1.500000, -0.519620), 1.000000),
                       cv( (-0.600000,  1.500000,  0.000000), 1.000000),
                       cv( (-0.300000,  1.500000,  0.519620), 1.000000)),
                      (cv( (-0.300000,  0.500000, -0.519620), 1.000000),
                       cv( (-0.600000,  0.500000,  0.000000), 1.000000),
                       cv( (-0.300000,  0.500000,  0.519620), 1.000000),
                       cv( ( 0.300000,  0.500000,  0.519610), 1.000000),
                       cv( ( 0.600000,  0.500000,  0.000000), 1.000000),
                       cv( ( 0.300000,  0.500000, -0.519620), 1.000000),
                       cv( (-0.300000,  0.500000, -0.519620), 1.000000),
                       cv( (-0.600000,  0.500000,  0.000000), 1.000000),
                       cv( (-0.300000,  0.500000,  0.519620), 1.000000)),
                      (cv( (-0.300000, -0.500000, -0.519620), 1.000000),
                       cv( (-0.600000, -0.500000,  0.000000), 1.000000),
                       cv( (-0.300000, -0.500000,  0.519620), 1.000000),
                       cv( ( 0.300000, -0.500000,  0.519610), 1.000000),
                       cv( ( 0.600000, -0.500000,  0.000000), 1.000000),
                       cv( ( 0.300000, -0.500000, -0.519620), 1.000000),
                       cv( (-0.300000, -0.500000, -0.519620), 1.000000),
                       cv( (-0.600000, -0.500000,  0.000000), 1.000000),
                       cv( (-0.300000, -0.500000,  0.519620), 1.000000)),
                      (cv( (-0.300000, -1.500000, -0.519620), 1.000000),
                       cv( (-0.600000, -1.500000,  0.000000), 1.000000),
                       cv( (-0.300000, -1.500000,  0.519620), 1.000000),
                       cv( ( 0.300000, -1.500000,  0.519610), 1.000000),
                       cv( ( 0.600000, -1.500000,  0.000000), 1.000000),
                       cv( ( 0.300000, -1.500000, -0.519620), 1.000000),
                       cv( (-0.300000, -1.500000, -0.519620), 1.000000),
                       cv( (-0.600000, -1.500000,  0.000000), 1.000000),
                       cv( (-0.300000, -1.500000,  0.519620), 1.000000))
                     )
             );
        patch( shader = ( Cyan ),
               doublesided = TRUE, vclosed = TRUE, 
               subdivide = uniform, divisions = (4, 4),
               udegree = 3, vdegree = 3,
               uknots = (-2.000000, -1.000000, 0.000000, 1.000000, 2.000000,
                         3.000000),
               vknots = (-0.333333, -0.166667, 0.000000, 0.166667, 0.333333,
                         0.500000, 0.666667, 0.833333, 1.000000, 1.166667,
                         1.333333),
               cvs = ((cv( (0.300000, 0.500000, 0.519620), 1.000000),
                       cv( (0.600000, 0.500000, 0.000000), 1.000000),
                       cv( (0.300000, 0.500000, -0.519620), 1.000000),
                       cv( (-0.300000, 0.500000, -0.519610), 1.000000),
                       cv( (-0.600000, 0.500000, 0.000000), 1.000000),
                       cv( (-0.300000, 0.500000, 0.519620), 1.000000),
                       cv( (0.300000, 0.500000, 0.519620), 1.000000),
                       cv( (0.600000, 0.500000, 0.000000), 1.000000),
                       cv( (0.300000, 0.500000, -0.519620), 1.000000)),
                       (cv( (0.000000, 0.500000, 0.000000), 1.000000),
                       cv( (0.000000, 0.500000, 0.000000), 1.000000),
                       cv( (0.000000, 0.500000, 0.000000), 1.000000),
                       cv( (0.000000, 0.500000, 0.000000), 1.000000),
                       cv( (0.000000, 0.500000, 0.000000), 1.000000),
                       cv( (0.000000, 0.500000, 0.000000), 1.000000),
                       cv( (0.000000, 0.500000, 0.000000), 1.000000),
                       cv( (0.000000, 0.500000, 0.000000), 1.000000),
                       cv( (0.000000, 0.500000, 0.000000), 1.000000)),
                       (cv( (-0.300000, 0.500000, -0.519620), 1.000000),
                       cv( (-0.600000, 0.500000, 0.000000), 1.000000),
                       cv( (-0.300000, 0.500000, 0.519620), 1.000000),
                       cv( (0.300000, 0.500000, 0.519610), 1.000000),
                       cv( (0.600000, 0.500000, 0.000000), 1.000000),
                       cv( (0.300000, 0.500000, -0.519620), 1.000000),
                       cv( (-0.300000, 0.500000, -0.519620), 1.000000),
                       cv( (-0.600000, 0.500000, 0.000000), 1.000000),
                       cv( (-0.300000, 0.500000, 0.519620), 1.000000)),
                       (cv( (-0.600000, 0.500000, -1.039230), 1.000000),
                       cv( (-1.200000, 0.500000, 0.000000), 1.000000),
                       cv( (-0.600000, 0.500000, 1.039230), 1.000000),
                       cv( (0.600000, 0.500000, 1.039230), 1.000000),
                       cv( (1.200000, 0.500000, 0.000000), 1.000000),
                       cv( (0.600000, 0.500000, -1.039230), 1.000000),
                       cv( (-0.600000, 0.500000, -1.039230), 1.000000),
                       cv( (-1.200000, 0.500000, 0.000000), 1.000000),
                       cv( (-0.600000, 0.500000, 1.039230), 1.000000))
                     )
             );
    }
}
{
    translate (xwrist, ywrist, zwrist);
    dx = (xtarget - xwrist);
    dy = (ytarget - ywrist);
    dz = (ztarget - zwrist);
    length = (((dx * dx) + (dy * dy)) + (dz * dz));
    length = sqrt( length );
    xzlength = ((dx * dx) + (dz * dz));
    xzlength = sqrt( xzlength );
    if (((xzlength < 0.000001) && (fabs( dy ) < 0.000001)))
    {
        zangle = 0.000000;
    }

    else
    {
        zangle = atan2d( dy, xzlength );
    }
    if (((fabs( dz ) < 0.000001) && (fabs( dx ) < 0.000001)))
    {
        yangle = 0.000000;
    }

    else
    {
        yangle = -atan2d( dz, dx );
    }
    translate (x1, y1, z1);
    rotate    ( yaxis, yangle);
    rotate    ( zaxis, zangle);
/* Define segment 3*/
    scale     (segmentlen3, segmentrad3, segmentrad3);
    translate (0.500000, 0.000000, 0.000000);
    rotate    ( zaxis, 90.000000);
    rotate    ( xaxis, 90.000000);
    patch( shader = ( Yellow ),
           doublesided = TRUE,
           subdivide = uniform, divisions = (4, 4),
           udegree = 3, vdegree = 3,
           uknots = ( 0.0,  0.0,  0.0,  1.0,  1.0, 1.0 ),
           vknots = ( 0.0,  1.0,  2.0,  3.0,  4.0,
                      5.0,  6.0,  7.0,  8.0,  9.0,
                     10.0, 11.0, 12.0 ),
           cvs = (
            (cv((  0.3918057,  -0.3918058,   0.5      ),   1.0      ),
             cv((  0.554097 ,   0.0      ,   0.5      ),   1.0      ),
             cv((  0.3918057,   0.3918056,   0.5      ),   1.0      ),
             cv((  0.0      ,   0.5540967,   0.5      ),   1.0      ),
             cv(( -0.3918056,   0.3918054,   0.5      ),   1.0      ),
             cv(( -0.5540966,   0.0      ,   0.5      ),   1.0      ),
             cv(( -0.3918053,  -0.3918054,   0.5      ),   1.0      ),
             cv((  0.0      ,  -0.5540963,   0.5      ),   1.0      ),
             cv((  0.3918054,  -0.391805 ,   0.5      ),   1.0      ),
             cv((  0.5540962,   0.0      ,   0.5      ),   1.0      ),
             cv((  0.3918048,   0.3918052,   0.5      ),   1.0      ) ),

            (cv((  0.3918057,  -0.3918058,   0.1666667),   1.0      ),
             cv((  0.554097 ,   0.0      ,   0.1666667),   1.0      ),
             cv((  0.3918057,   0.3918056,   0.1666667),   1.0      ),
             cv((  0.0      ,   0.5540967,   0.1666667),   1.0      ),
             cv(( -0.3918056,   0.3918054,   0.1666667),   1.0      ),
             cv(( -0.5540966,   0.0      ,   0.1666667),   1.0      ),
             cv(( -0.3918053,  -0.3918054,   0.1666667),   1.0      ),
             cv((  0.0      ,  -0.5540963,   0.1666667),   1.0      ),
             cv((  0.3918054,  -0.391805 ,   0.1666667),   1.0      ),
             cv((  0.5540962,   0.0      ,   0.1666667),   1.0      ),
             cv((  0.3918048,   0.3918052,   0.1666667),   1.0      ) ),

            (cv((  0.3918057,  -0.3918058,  -0.1666667),   1.0      ),
             cv((  0.554097 ,   0.0      ,  -0.1666667),   1.0      ),
             cv((  0.3918057,   0.3918056,  -0.1666667),   1.0      ),
             cv((  0.0      ,   0.5540967,  -0.1666667),   1.0      ),
             cv(( -0.3918056,   0.3918054,  -0.1666667),   1.0      ),
             cv(( -0.5540966,   0.0      ,  -0.1666667),   1.0      ),
             cv(( -0.3918053,  -0.3918054,  -0.1666667),   1.0      ),
             cv((  0.0      ,  -0.5540963,  -0.1666667),   1.0      ),
             cv((  0.3918054,  -0.391805 ,  -0.1666667),   1.0      ),
             cv((  0.5540962,   0.0      ,  -0.1666667),   1.0      ),
             cv((  0.3918048,   0.3918052,  -0.1666667),   1.0      ) ),

            (cv((  0.3918057,  -0.3918058,  -0.5      ),   1.0      ),
             cv((  0.554097 ,   0.0      ,  -0.5      ),   1.0      ),
             cv((  0.3918057,   0.3918056,  -0.5      ),   1.0      ),
             cv((  0.0      ,   0.5540967,  -0.5      ),   1.0      ),
             cv(( -0.3918056,   0.3918054,  -0.5      ),   1.0      ),
             cv(( -0.5540966,   0.0      ,  -0.5      ),   1.0      ),
             cv(( -0.3918053,  -0.3918054,  -0.5      ),   1.0      ),
             cv((  0.0      ,  -0.5540963,  -0.5      ),   1.0      ),
             cv((  0.3918054,  -0.391805 ,  -0.5      ),   1.0      ),
             cv((  0.5540962,   0.0      ,  -0.5      ),   1.0      ),
             cv((  0.3918048,   0.3918052,  -0.5      ),   1.0      ) )
          )
    );
    patch (shader = ( Yellow ),
        doublesided = TRUE,
           subdivide = uniform, divisions = (4, 4),
        udegree = 3, vdegree = 3,
    uknots = ( 0.0      ,  0.0      ,  0.0      ,  1.0      ,  1.0      ,
                 1.0      ),
    vknots = ( 0.0      ,  1.0      ,  2.0      ,  3.0      ,  4.0      ,
                 5.0      ,  6.0      ,  7.0      ,  8.0      ,  9.0      ,
                 10.0      ,  11.0      ,  12.0      ),
    cvs = (
            (cv((  0.0      ,   0.0      ,   0.5      ),   1.0      ),
             cv((  0.0      ,   0.0      ,   0.5      ),   1.0      ),
             cv((  0.0      ,   0.0      ,   0.5      ),   1.0      ),
             cv((  0.0      ,   0.0      ,   0.5      ),   1.0      ),
             cv((  0.0      ,   0.0      ,   0.5      ),   1.0      ),
             cv((  0.0      ,   0.0      ,   0.5      ),   1.0      ),
             cv((  0.0      ,   0.0      ,   0.5      ),   1.0      ),
             cv((  0.0      ,   0.0      ,   0.5      ),   1.0      ),
             cv((  0.0      ,   0.0      ,   0.5      ),   1.0      ),
             cv((  0.0      ,   0.0      ,   0.5      ),   1.0      ),
             cv((  0.0      ,   0.0      ,   0.5      ),   1.0      ) ),

            (cv((  0.1306019,  -0.1306019,   0.5      ),   1.0      ),
             cv((  0.184699 ,   0.0      ,   0.5      ),   1.0      ),
             cv((  0.1306019,   0.1306019,   0.5      ),   1.0      ),
             cv((  0.0      ,   0.1846989,   0.5      ),   1.0      ),
             cv(( -0.1306019,   0.1306018,   0.5      ),   1.0      ),
             cv(( -0.1846989,   0.0      ,   0.5      ),   1.0      ),
             cv(( -0.1306018,  -0.1306018,   0.5      ),   1.0      ),
             cv((  0.0      ,  -0.1846988,   0.5      ),   1.0      ),
             cv((  0.1306018,  -0.1306017,   0.5      ),   1.0      ),
             cv((  0.1846987,   0.0      ,   0.5      ),   1.0      ),
             cv((  0.1306016,   0.1306017,   0.5      ),   1.0      ) ),

            (cv((  0.2612038,  -0.2612039,   0.5      ),   1.0      ),
             cv((  0.369398 ,   0.0      ,   0.5      ),   1.0      ),
             cv((  0.2612038,   0.2612037,   0.5      ),   1.0      ),
             cv((  0.0      ,   0.3693978,   0.5      ),   1.0      ),
             cv(( -0.2612037,   0.2612036,   0.5      ),   1.0      ),
             cv(( -0.3693977,   0.0      ,   0.5      ),   1.0      ),
             cv(( -0.2612035,  -0.2612036,   0.5      ),   1.0      ),
             cv((  0.0      ,  -0.3693975,   0.5      ),   1.0      ),
             cv((  0.2612036,  -0.2612033,   0.5      ),   1.0      ),
             cv((  0.3693974,   0.0      ,   0.5      ),   1.0      ),
             cv((  0.2612032,   0.2612035,   0.5      ),   1.0      ) ),

            (cv((  0.3918057,  -0.3918058,   0.5      ),   1.0      ),
             cv((  0.554097 ,   0.0      ,   0.5      ),   1.0      ),
             cv((  0.3918057,   0.3918056,   0.5      ),   1.0      ),
             cv((  0.0      ,   0.5540967,   0.5      ),   1.0      ),
             cv(( -0.3918056,   0.3918054,   0.5      ),   1.0      ),
             cv(( -0.5540966,   0.0      ,   0.5      ),   1.0      ),
             cv(( -0.3918053,  -0.3918054,   0.5      ),   1.0      ),
             cv((  0.0      ,  -0.5540963,   0.5      ),   1.0      ),
             cv((  0.3918054,  -0.391805 ,   0.5      ),   1.0      ),
             cv((  0.5540962,   0.0      ,   0.5      ),   1.0      ),
             cv((  0.3918048,   0.3918052,   0.5      ),   1.0      ) )
           )
    );
    patch (shader = ( Yellow ),
        doublesided = TRUE,
           subdivide = uniform, divisions = (4, 4),
        udegree = 3, vdegree = 3,
    uknots = ( 0.0      ,  0.0      ,  0.0      ,  1.0      ,  1.0      ,
                 1.0      ),
    vknots = ( 0.0      ,  1.0      ,  2.0      ,  3.0      ,  4.0      ,
                 5.0      ,  6.0      ,  7.0      ,  8.0      ,  9.0      ,
                 10.0      ,  11.0      ,  12.0      ),
    cvs = (
            (cv((  0.0      ,   0.0      ,  -0.5      ),   1.0      ),
             cv((  0.0      ,   0.0      ,  -0.5      ),   1.0      ),
             cv((  0.0      ,   0.0      ,  -0.5      ),   1.0      ),
             cv((  0.0      ,   0.0      ,  -0.5      ),   1.0      ),
             cv((  0.0      ,   0.0      ,  -0.5      ),   1.0      ),
             cv((  0.0      ,   0.0      ,  -0.5      ),   1.0      ),
             cv((  0.0      ,   0.0      ,  -0.5      ),   1.0      ),
             cv((  0.0      ,   0.0      ,  -0.5      ),   1.0      ),
             cv((  0.0      ,   0.0      ,  -0.5      ),   1.0      ),
             cv((  0.0      ,   0.0      ,  -0.5      ),   1.0      ),
             cv((  0.0      ,   0.0      ,  -0.5      ),   1.0      ) ),

            (cv((  0.1306019,  -0.1306019,  -0.5      ),   1.0      ),
             cv((  0.184699 ,   0.0      ,  -0.5      ),   1.0      ),
             cv((  0.1306019,   0.1306019,  -0.5      ),   1.0      ),
             cv((  0.0      ,   0.1846989,  -0.5      ),   1.0      ),
             cv(( -0.1306019,   0.1306018,  -0.5      ),   1.0      ),
             cv(( -0.1846989,   0.0      ,  -0.5      ),   1.0      ),
             cv(( -0.1306018,  -0.1306018,  -0.5      ),   1.0      ),
             cv((  0.0      ,  -0.1846988,  -0.5      ),   1.0      ),
             cv((  0.1306018,  -0.1306017,  -0.5      ),   1.0      ),
             cv((  0.1846987,   0.0      ,  -0.5      ),   1.0      ),
             cv((  0.1306016,   0.1306017,  -0.5      ),   1.0      ) ),

            (cv((  0.2612038,  -0.2612039,  -0.5      ),   1.0      ),
             cv((  0.369398 ,   0.0      ,  -0.5      ),   1.0      ),
             cv((  0.2612038,   0.2612037,  -0.5      ),   1.0      ),
             cv((  0.0      ,   0.3693978,  -0.5      ),   1.0      ),
             cv(( -0.2612037,   0.2612036,  -0.5      ),   1.0      ),
             cv(( -0.3693977,   0.0      ,  -0.5      ),   1.0      ),
             cv(( -0.2612035,  -0.2612036,  -0.5      ),   1.0      ),
             cv((  0.0      ,  -0.3693975,  -0.5      ),   1.0      ),
             cv((  0.2612036,  -0.2612033,  -0.5      ),   1.0      ),
             cv((  0.3693974,   0.0      ,  -0.5      ),   1.0      ),
             cv((  0.2612032,   0.2612035,  -0.5      ),   1.0      ) ),

            (cv((  0.3918057,  -0.3918058,  -0.5      ),   1.0      ),
             cv((  0.554097 ,   0.0      ,  -0.5      ),   1.0      ),
             cv((  0.3918057,   0.3918056,  -0.5      ),   1.0      ),
             cv((  0.0      ,   0.5540967,  -0.5      ),   1.0      ),
             cv(( -0.3918056,   0.3918054,  -0.5      ),   1.0      ),
             cv(( -0.5540966,   0.0      ,  -0.5      ),   1.0      ),
             cv(( -0.3918053,  -0.3918054,  -0.5      ),   1.0      ),
             cv((  0.0      ,  -0.5540963,  -0.5      ),   1.0      ),
             cv((  0.3918054,  -0.391805 ,  -0.5      ),   1.0      ),
             cv((  0.5540962,   0.0      ,  -0.5      ),   1.0      ),
             cv((  0.3918048,   0.3918052,  -0.5      ),   1.0      ) )
           )
    );
}
{
    translate (xtarget, ytarget, ztarget);
    scale     (0.100000, 0.100000, 0.100000);
    patch (shader = ( Green ),
        doublesided = FALSE, vclosed = TRUE, 
           subdivide = uniform, divisions = (4, 4),
        udegree = 3, vdegree = 3,
        uknots = (-0.666667, -0.333333, 0.000000, 0.333333, 0.666667,
                   1.000000, 1.333333, 1.666667),
        vknots = (-0.333333, -0.166667, 0.000000, 0.166667, 0.333333,
                   0.500000, 0.666667, 0.833333, 1.000000, 1.166667,
                   1.333333),
        cvs = ((cv( (-0.311775, -0.300000, -0.540010), 1.000000),
                cv( (-0.623550, -0.300000,  0.000000), 1.000000),
                cv( (-0.311775, -0.300000,  0.540010), 1.000000),
                cv( ( 0.311775, -0.300000,  0.540010), 1.000000),
                cv( ( 0.623549, -0.300000,  0.000000), 1.000000),
                cv( ( 0.311774, -0.300000, -0.540010), 1.000000),
                cv( (-0.311775, -0.300000, -0.540010), 1.000000),
                cv( (-0.623550, -0.300000,  0.000000), 1.000000),
                cv( (-0.311775, -0.300000,  0.540010), 1.000000)),
               (cv( ( 0.000000, -0.600000,  0.000000), 1.000000),
                cv( ( 0.000000, -0.600000,  0.000000), 1.000000),
                cv( ( 0.000000, -0.600000,  0.000000), 1.000000),
                cv( ( 0.000000, -0.600000,  0.000000), 1.000000),
                cv( ( 0.000000, -0.600000,  0.000000), 1.000000),
                cv( ( 0.000000, -0.600000,  0.000000), 1.000000),
                cv( ( 0.000000, -0.600000,  0.000000), 1.000000),
                cv( ( 0.000000, -0.600000,  0.000000), 1.000000),
                cv( ( 0.000000, -0.600000,  0.000000), 1.000000)),
               (cv( ( 0.311769, -0.300000,  0.539999), 1.000000),
                cv( ( 0.623538, -0.300000,  0.000000), 1.000000),
                cv( ( 0.311769, -0.300000, -0.539999), 1.000000),
                cv( (-0.311769, -0.300000, -0.539999), 1.000000),
                cv( (-0.623538, -0.300000,  0.000000), 1.000000),
                cv( (-0.311769, -0.300000,  0.539999), 1.000000),
                cv( ( 0.311769, -0.300000,  0.539999), 1.000000),
                cv( ( 0.623538, -0.300000,  0.000000), 1.000000),
                cv( ( 0.311769, -0.300000, -0.539999), 1.000000)),
               (cv( ( 0.311769,  0.300000,  0.539999), 1.000000),
                cv( ( 0.623537,  0.300000,  0.000000), 1.000000),
                cv( ( 0.311769,  0.300000, -0.539999), 1.000000),
                cv( (-0.311769,  0.300000, -0.539999), 1.000000),
                cv( (-0.623537,  0.300000,  0.000000), 1.000000),
                cv( (-0.311768,  0.300000,  0.539999), 1.000000),
                cv( ( 0.311769,  0.300000,  0.539999), 1.000000),
                cv( ( 0.623537,  0.300000,  0.000000), 1.000000),
                cv( ( 0.311769,  0.300000, -0.539999), 1.000000)),
               (cv( ( 0.000000,  0.599999,  0.000000), 1.000000),
                cv( ( 0.000000,  0.599999,  0.000000), 1.000000),
                cv( ( 0.000000,  0.599999,  0.000000), 1.000000),
                cv( ( 0.000000,  0.599999,  0.000000), 1.000000),
                cv( ( 0.000000,  0.599999,  0.000000), 1.000000),
                cv( ( 0.000000,  0.599999,  0.000000), 1.000000),
                cv( ( 0.000000,  0.599999,  0.000000), 1.000000),
                cv( ( 0.000000,  0.599999,  0.000000), 1.000000),
                cv( ( 0.000000,  0.599999,  0.000000), 1.000000)),
               (cv( (-0.311775,  0.299999, -0.540010), 1.000000),
                cv( (-0.623549,  0.299999,  0.000000), 1.000000),
                cv( (-0.311775,  0.299999,  0.540010), 1.000000),
                cv( ( 0.311775,  0.299999,  0.540010), 1.000000),
                cv( ( 0.623549,  0.299999,  0.000000), 1.000000),
                cv( ( 0.311774,  0.299999, -0.540009), 1.000000),
                cv( (-0.311775,  0.299999, -0.540010), 1.000000),
                cv( (-0.623549,  0.299999,  0.000000), 1.000000),
                cv( (-0.311775,  0.299999,  0.540010), 1.000000))
        )
    );
}
