Пример #1
0
        /// <inheritdoc/>
        public bool Intersects(LineString2 other)
        {
            if (Count == 0 || ReferenceEquals(null, other) || other.Count == 0)
            {
                return(false);
            }
            if (Count == 1)
            {
                return(other.Intersects(this[0]));
            }
            if (other.Count == 1)
            {
                return(Intersects(other[0]));
            }

            for (int segmentIndexA = 0; segmentIndexA < SegmentCount; segmentIndexA++)
            {
                var segmentA = GetSegment(segmentIndexA);
                if (other.Intersects(segmentA))
                {
                    return(true);
                }
            }
            return(false);
        }
Пример #2
0
        /// <inheritdoc/>
        public IPlanarGeometry Intersection(LineString2 other)
        {
            if (Count == 0 || ReferenceEquals(null, other) || other.Count == 0)
            {
                return(null);
            }
            if (Count == 1)
            {
                return(other.Intersects(this[0]) ? (IPlanarGeometry)this[0] : null);
            }
            if (other.Count == 1)
            {
                return(Intersects(other[0]) ? (IPlanarGeometry)other[0] : null);
            }

            throw new NotImplementedException();
        }
Пример #3
0
        /// <inheritdoc/>
        public bool Equals(LineString2 other)
        {
            if (ReferenceEquals(null, other))
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }
            if (Count != other.Count)
            {
                return(false);
            }

            for (var i = 0; i < Count; i++)
            {
                if (!this[i].Equals(other[i]))
                {
                    return(false);
                }
            }
            return(true);
        }