// Remove all polygons in this BSP tree that are inside the other BSP tree
        // `bsp`.
        public void ClipTo(CSGNode _otherNode, int _recursionCount = 0)
        {
            if (_recursionCount > C_MaxRecursions)
            {
                Debug.LogWarning("Hit RecursionCap");
                return;
            }

            m_polygons = _otherNode.ClipPolygons(m_polygons, 0);

            if (m_frontNode != null)
            {
                m_frontNode.ClipTo(_otherNode, _recursionCount + 1);
            }

            if (m_backNode != null)
            {
                m_backNode.ClipTo(_otherNode, _recursionCount + 1);
            }
        }
        // Recursively remove all polygons in `polygons` that are inside this BSP
        // tree.
        public List <CSGPolygon> ClipPolygons(List <CSGPolygon> _polygons, int _recursionCount = 0)
        {
            if (_recursionCount > C_MaxRecursions)
            {
                Debug.LogWarning("Hit RecursionCap");
                return(_polygons);
            }

            if (!m_plane.Valid())
            {
                return(_polygons);
            }

            List <CSGPolygon> frontPolygons = new List <CSGPolygon>();
            List <CSGPolygon> backPolygons  = new List <CSGPolygon>();

            for (int polygonIter = 0; polygonIter < _polygons.Count; polygonIter++)
            {
                m_plane.SplitPolygon(_polygons[polygonIter], frontPolygons, backPolygons, frontPolygons, backPolygons);
            }

            if (m_frontNode != null)
            {
                frontPolygons = m_frontNode.ClipPolygons(frontPolygons, _recursionCount + 1);
            }

            if (m_backNode != null)
            {
                backPolygons = m_backNode.ClipPolygons(backPolygons, _recursionCount + 1);
            }
            else
            {
                backPolygons.Clear();
            }

            frontPolygons.AddRange(backPolygons);

            return(frontPolygons);
        }