Example #1
0
    public bool IntersectElement(ITestIntersect pTestIntersect, IElement pIntersectElement = null)
    {
        if (m_pRoot == null)
        {
            return(false);
        }

        if (m_pRoot.IntersectElement(pTestIntersect, pIntersectElement))
        {
            return(true);
        }

        foreach (IElement element in m_lstElement)
        {
            if (pTestIntersect.TestIntersect(element))
            {
                if (pIntersectElement != null)
                {
                    pIntersectElement = element;
                }
            }
        }

        return(false);
    }
Example #2
0
    public void CollectIntersect(ITestIntersect pTestIntersect, ref List <IElement> rst)
    {
        if (m_pRoot == null)
        {
            return;
        }

        if (pTestIntersect == null)
        {
            return;
        }

        rst.Clear();

        if (pTestIntersect.TestIntersect(m_pRoot.m_fMinX, m_pRoot.m_fMaxX,
                                         m_pRoot.m_fMinZ, m_pRoot.m_fMaxZ))
        {
            m_pRoot.CollectIntersect(pTestIntersect, ref rst);
        }

        foreach (IElement element in m_lstElement)
        {
            if (pTestIntersect.TestIntersect(element))
            {
                rst.Add(element);
            }
        }
    }
Example #3
0
    public bool IntersectElement(ITestIntersect pTestIntersect, IElement pIntersectElement)
    {
        if (pTestIntersect == null)
        {
            return(false);
        }

        if (!pTestIntersect.TestIntersect(m_fMinX, m_fMaxX, m_fMinZ, m_fMaxZ))
        {
            return(false);
        }

        if (m_pTopLeft != null && m_pTopLeft.IntersectElement(pTestIntersect, pIntersectElement))
        {
            return(true);
        }

        if (m_pTopRight != null && m_pTopRight.IntersectElement(pTestIntersect, pIntersectElement))
        {
            return(true);
        }

        if (m_pBottomLeft != null && m_pBottomLeft.IntersectElement(pTestIntersect, pIntersectElement))
        {
            return(true);
        }

        if (m_pBottomRight != null && m_pBottomRight.IntersectElement(pTestIntersect, pIntersectElement))
        {
            return(true);
        }

        foreach (IElement element in m_lstElement)
        {
            if (pTestIntersect.TestIntersect(element))
            {
                pIntersectElement = element;
                return(true);
            }
        }

        return(false);
    }
Example #4
0
    public void CollectIntersect(ITestIntersect pTestIntersect, ref List <IElement> rst)
    {
        if (pTestIntersect == null)
        {
            return;
        }

        if (m_pTopLeft != null && pTestIntersect.TestIntersect(m_pTopLeft.m_fMinX, m_pTopLeft.m_fMaxX,
                                                               m_pTopLeft.m_fMinZ, m_pTopLeft.m_fMaxZ))
        {
            m_pTopLeft.CollectIntersect(pTestIntersect, ref rst);
        }

        if (m_pTopRight != null && pTestIntersect.TestIntersect(m_pTopRight.m_fMinX, m_pTopRight.m_fMaxX,
                                                                m_pTopRight.m_fMinZ, m_pTopRight.m_fMaxZ))
        {
            m_pTopRight.CollectIntersect(pTestIntersect, ref rst);
        }

        if (m_pBottomLeft != null && pTestIntersect.TestIntersect(m_pBottomLeft.m_fMinX, m_pBottomLeft.m_fMaxX,
                                                                  m_pBottomLeft.m_fMinZ, m_pBottomLeft.m_fMaxZ))
        {
            m_pBottomLeft.CollectIntersect(pTestIntersect, ref rst);
        }

        if (m_pBottomRight != null && pTestIntersect.TestIntersect(m_pBottomRight.m_fMinX, m_pBottomRight.m_fMaxX,
                                                                   m_pBottomRight.m_fMinZ, m_pBottomRight.m_fMaxZ))
        {
            m_pBottomRight.CollectIntersect(pTestIntersect, ref rst);
        }

        foreach (IElement element in m_lstElement)
        {
            if (pTestIntersect.TestIntersect(element))
            {
                rst.Add(element);
            }
        }
    }