/// <summary>
        /// Cuts a cube with another one.
        /// </summary>
        private Boolean Cut(WuColorCube first, WuColorCube second)
        {
            Int32 direction;

            Int32[] cutRed   = { 0 };
            Int32[] cutGreen = { 0 };
            Int32[] cutBlue  = { 0 };

            Int64 wholeRed    = Volume(first, momentsRed);
            Int64 wholeGreen  = Volume(first, momentsGreen);
            Int64 wholeBlue   = Volume(first, momentsBlue);
            Int64 wholeWeight = Volume(first, weights);

            Single maxRed   = Maximize(first, Red, first.RedMinimum + 1, first.RedMaximum, cutRed, wholeRed, wholeGreen, wholeBlue, wholeWeight);
            Single maxGreen = Maximize(first, Green, first.GreenMinimum + 1, first.GreenMaximum, cutGreen, wholeRed, wholeGreen, wholeBlue, wholeWeight);
            Single maxBlue  = Maximize(first, Blue, first.BlueMinimum + 1, first.BlueMaximum, cutBlue, wholeRed, wholeGreen, wholeBlue, wholeWeight);

            if ((maxRed >= maxGreen) && (maxRed >= maxBlue))
            {
                direction = Red;

                // cannot split empty cube
                if (cutRed[0] < 0)
                {
                    return(false);
                }
            }
            else
            {
                if ((maxGreen >= maxRed) && (maxGreen >= maxBlue))
                {
                    direction = Green;
                }
                else
                {
                    direction = Blue;
                }
            }

            second.RedMaximum   = first.RedMaximum;
            second.GreenMaximum = first.GreenMaximum;
            second.BlueMaximum  = first.BlueMaximum;

            // cuts in a certain direction
            switch (direction)
            {
            case Red:
                second.RedMinimum   = first.RedMaximum = cutRed[0];
                second.GreenMinimum = first.GreenMinimum;
                second.BlueMinimum  = first.BlueMinimum;
                break;

            case Green:
                second.GreenMinimum = first.GreenMaximum = cutGreen[0];
                second.RedMinimum   = first.RedMinimum;
                second.BlueMinimum  = first.BlueMinimum;
                break;

            case Blue:
                second.BlueMinimum  = first.BlueMaximum = cutBlue[0];
                second.RedMinimum   = first.RedMinimum;
                second.GreenMinimum = first.GreenMinimum;
                break;
            }

            // determines the volumes after cut
            first.Volume  = (first.RedMaximum - first.RedMinimum) * (first.GreenMaximum - first.GreenMinimum) * (first.BlueMaximum - first.BlueMinimum);
            second.Volume = (second.RedMaximum - second.RedMinimum) * (second.GreenMaximum - second.GreenMinimum) * (second.BlueMaximum - second.BlueMinimum);

            // the cut was successfull
            return(true);
        }