Ejemplo n.º 1
0
        public void Add(PointAxis2d.Value value)
        {
            List <double> points;

            if (!m_points.TryGetValue(value.Abscissa, out points))
            {
                points = new List <double>();
                m_points[value.Abscissa] = points;
                points.Add(value.Ordinate);
                return;
            }

            points.Add(value.Ordinate);
            points.Sort();
        }
Ejemplo n.º 2
0
        public Range1d Contains(PointAxis2d.Value value)
        {
            List <Range1d> segments;

            if (!m_lines.TryGetValue(value.Abscissa, out segments))
            {
                return(null);
            }

            foreach (Range1d segment in segments)
            {
                if (segment.Contains(value.Ordinate))
                {
                    return(segment);
                }
            }

            return(null);
        }
Ejemplo n.º 3
0
            public static Value FromLine2d(GridBasis basis, int ordinal, Line2d line, bool snap)
            {
                PointAxis2d.Value p0 = PointAxis2d.Value.FromPoint2d(basis, ordinal, line.StartPoint, snap);
                if (p0 == null)
                {
                    return(null);
                }

                PointAxis2d.Value p1 = PointAxis2d.Value.FromPoint2d(basis, ordinal, line.EndPoint, snap);
                if (p1 == null)
                {
                    return(null);
                }

                if (p0.Abscissa != p1.Abscissa)
                {
                    return(null);
                }

                return(new Value(p0.Abscissa, new Range1d(p0.Ordinate, p1.Ordinate)));
            }