internal RangeAxis2d GetAxisSegments(PointAxis2d intersections)
        {
            int         ordinal           = intersections.Ordinal;
            RangeAxis2d collinearSegments = new RangeAxis2d(m_basis, ordinal);

            foreach (Polygon2d polygon in m_outline.Polygons)
            {
                foreach (Line2d line in polygon.Lines)
                {
                    RangeAxis2d.Value value = RangeAxis2d.Value.FromLine2d(m_basis, ordinal, line, false);
                    if (value != null)
                    {
                        collinearSegments.Add(value);
                    }
                }
            }

            RangeAxis2d segments = new RangeAxis2d(m_basis, ordinal);

            foreach (KeyValuePair <int, List <double> > value in intersections.Points)
            {
                int           abscissa  = value.Key;
                List <double> ordinates = value.Value;

                if (ordinates.Count < 2)
                {
                    continue;
                }

                for (int index = 0; index < ordinates.Count - 1;)
                {
                    double first = ordinates[index++];
                    double next  = ordinates[index++];

                    if (index < ordinates.Count)
                    {
                        Range1d segment = collinearSegments.Contains(new PointAxis2d.Value(abscissa, next));
                        if (segment != null && ordinates.Count % 3 == 0)
                        {
                            next = ordinates[index++];
                        }
                    }

                    segments.Add(abscissa, new Range1d(first, next));
                }
            }

            return(segments);
        }
Exemplo n.º 2
0
 public void Add(RangeAxis2d.Value value)
 {
     Add(value.Abscissa, value.Ordinate);
 }