Ejemplo n.º 1
0
        /// <summary>
        /// 是否相交
        /// </summary>
        /// <param name="line"></param>
        /// <returns></returns>
        public bool Intersect(LineSegment2D line)
        {
            int statusSrc  = Utility2D.GetPointPosition(line.Src, Src, Dest);
            int statusDest = Utility2D.GetPointPosition(line.Dest, Src, Dest);

            if (statusSrc == 0 || statusDest == 0)
            {
                if (statusSrc == 0)
                {
                    return(this.Contains(line.Src));
                }
                if (statusDest == 0)
                {
                    return(this.Contains(line.Dest));
                }

                return(false);
            }
            return(statusSrc != statusDest);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 是否包含点
        /// </summary>
        /// <param name="point"></param>
        /// <returns></returns>
        public bool Contains(Vector2 point)
        {
            int ret = Utility2D.GetPointPosition(point, Points);

            return(ret <= 0);
        }