Exemplo n.º 1
0
        /// <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
            Envelope 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);
        }
Exemplo n.º 2
0
        /// <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
            Envelope 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;
        }