Exemplo n.º 1
0
 private void RecursFillFaceArray(List <Face> faces)
 {
     if (null != NodeRight)
     {
         NodeRight.RecursFillFaceArray(faces);
     }
     faces.Add(Face);
     if (null != NodeLeft)
     {
         NodeLeft.RecursFillFaceArray(faces);
     }
 }
Exemplo n.º 2
0
        public List <bool> Traverse(char symbol, List <bool> data)
        {
            if (NodeRight == null && NodeLeft == null)
            {
                if (symbol.Equals(this.Char))
                {
                    return(data);
                }
                else
                {
                    return(null);
                }
            }
            else
            {
                List <bool> left  = null;
                List <bool> right = null;

                if (NodeLeft != null)
                {
                    List <bool> leftPath = new List <bool>();
                    leftPath.AddRange(data);
                    leftPath.Add(false);
                    left = NodeLeft.Traverse(symbol, leftPath);
                }

                if (NodeRight != null)
                {
                    List <bool> rightPath = new List <bool>();
                    rightPath.AddRange(data);
                    rightPath.Add(true);
                    right = NodeRight.Traverse(symbol, rightPath);
                }

                if (left != null)
                {
                    return(left);
                }
                else
                {
                    return(right);
                }
            }
        }
Exemplo n.º 3
0
        // insertion methods
        public void Insert(Face f)
        {
            if (f.IsDegenerate)
            {
                return;
            }

            // check on which side the polygon is, posibly split
            List <Face> side_left  = new List <Face>();
            List <Face> side_right = new List <Face>();

            Split(f, ref side_left, ref side_right);

            // insert triangles
            foreach (Face face in side_left)
            {
                if (null == NodeLeft)
                {
                    NodeLeft = new BSPNode(face);
                }
                else
                {
                    NodeLeft.Insert(face);
                }
            }
            foreach (Face face in side_right)
            {
                if (null == NodeRight)
                {
                    NodeRight = new BSPNode(face);
                }
                else
                {
                    NodeRight.Insert(face);
                }
            }
        }