/// <summary> /// /// </summary> /// <param name="pt"></param> /// <returns></returns> public bool IsInside(ICoordinate pt) { crossings = 0; // test all segments intersected by ray from pt in positive x direction IEnvelope rayEnv = new Envelope(Double.NegativeInfinity, Double.PositiveInfinity, pt.Y, pt.Y); interval.Min = pt.Y; interval.Max = pt.Y; IList segs = tree.Query(interval); MCSelecter mcSelecter = new MCSelecter(this, pt); for (IEnumerator i = segs.GetEnumerator(); i.MoveNext();) { MonotoneChain mc = (MonotoneChain)i.Current; TestMonotoneChain(rayEnv, mcSelecter, mc); } /* * p is inside if number of crossings is odd. */ if ((crossings % 2) == 1) { return(true); } return(false); }
/// <summary> /// /// </summary> /// <param name="pt"></param> /// <returns></returns> public bool IsInside(Coordinate pt) { _crossings = 0; // test all segments intersected by ray from pt in positive x direction var rayEnv = new Envelope(Double.NegativeInfinity, Double.PositiveInfinity, pt.Y, pt.Y); _interval.Min = pt.Y; _interval.Max = pt.Y; //_interval = Interval.Create(pt.Y); IList <MonotoneChain> segs = _tree.Query(_interval); MCSelecter mcSelecter = new MCSelecter(this, pt); foreach (MonotoneChain mc in segs) { TestMonotoneChain(rayEnv, mcSelecter, mc); } /* * p is inside if number of crossings is odd. */ if ((_crossings % 2) == 1) { return(true); } return(false); }