Beispiel #1
0
        public bool IntersectComponents(Component componentA,
                                        Component componentB,
                                        ListInfoInters linters)
        {
            if ((componentA == null) || (componentB == null))
            {
                throw new ExceptionGMath("Outline", "IntersectComponents", null);
                //return false;
            }

            if (componentA == componentB)
            {
                return(true);
            }
            bool res = true;

            for (int pozContA = componentA.PozContStart;
                 pozContA < componentA.PozContStart + componentA.NumCont;
                 pozContA++)
            {
                Contour contA = this.ContourByPoz(pozContA);
                for (int pozContB = componentB.PozContStart;
                     pozContB < componentB.PozContStart + componentB.NumCont;
                     pozContB++)
                {
                    Contour contB = this.ContourByPoz(pozContB);
                    if (!contA.Intersect(contB, linters))
                    {
                        res = false;
                    }
                }
            }
            return(res);
        }
Beispiel #2
0
        public bool Intersect(ListInfoInters linters)
        {
            bool res = true;

            foreach (Contour cont in this.conts)
            {
                bool isWrapped;
                if (!cont.IsWrapped(out isWrapped))
                {
                    res = false;
                }
                else
                {
                    if (!isWrapped)
                    {
                        cont.Intersect(linters);
                    }
                }
            }
            for (int pozA = 0; pozA < this.NumCont - 1; pozA++)
            {
                Contour contA = this.ContourByPoz(pozA);
                for (int pozB = pozA + 1; pozB < this.NumCont; pozB++)
                {
                    Contour contB = this.ContourByPoz(pozB);
                    bool    isDuplicated;
                    if (!contA.AreDuplicated(contB, out isDuplicated))
                    {
                        res = false;
                    }
                    else
                    {
                        if (!isDuplicated)
                        {
                            if (!contA.Intersect(contB, linters))
                            {
                                res = false;
                            }
                        }
                    }
                }
            }
            return(res);
        }