Beispiel #1
0
        public bool Intersects(VectorPath path)
        {
            if (path == this)
            {
                return(false);
            }

            if (polygons == null)
            {
                BuildPolygons();
            }

            intersectList.Remove(path);
            path.intersectList.Remove(this);

            if (IsBoundInside(path))
            {
                List <PointF[]> tpoly = GetTransfomedPolygons();
                foreach (PointF[] pts in tpoly)
                {
                    foreach (PointF p in pts)
                    {
                        if (path.IsPointInside(p, false))
                        {
                            intersectList.Add(path);
                            path.intersectList.Add(this);

                            return(true);
                        }
                    }
                }

                tpoly = path.GetTransfomedPolygons();
                foreach (PointF[] pts in tpoly)
                {
                    foreach (PointF p in pts)
                    {
                        if (IsPointInside(p, false))
                        {
                            intersectList.Add(path);
                            path.intersectList.Add(this);
                            return(true);
                        }
                    }
                }
            }

            return(false);
        }
Beispiel #2
0
        public bool IsBoundInside(VectorPath path)
        {
            PointF[] bp = GetBoundPoints();

            foreach (PointF p in bp)
            {
                if (path.IsPointInside(p, true))
                {
                    return(true);
                }
            }

            if (path.IsPointInside(new PointF(posx, posy), true))
            {
                return(true);
            }

            if (IsPointInside(new PointF(path.posx, path.posy), true))
            {
                return(true);
            }

            return(false);
        }