Exemple #1
0
        void RemoveUnneededLines(NuGenSegment[] lastSegment, NuGenSegment[] currSegment, int height, SegmentSettings seg)
        {
            NuGenSegment segLast = null;

            for (int yLast = 0; yLast < height; yLast++)
            {
                if ((lastSegment[yLast] != null) && (lastSegment [yLast] != segLast))
                {
                    segLast = lastSegment [yLast];

                    // if the segment is found in the current column then it is still in work so postpone processing
                    bool found = false;
                    for (int yCur = 0; yCur < height; yCur++)
                    {
                        if (segLast == currSegment [yCur])
                        {
                            found = true;
                            break;
                        }
                    }

                    if (!found)
                    {
                        if (segLast.Length < (seg.minPoints - 1) * seg.pointSeparation)
                        {
                            segments.Remove(segLast); // autoDelete is on
                        }
                        else
                        {
                            // keep segment, but try to fold lines
                            segLast.RemoveUnneededLines();
                        }
                    }
                }
            }
        }