예제 #1
0
        /// <summary>
        /// Sets the children for the left and right side. This effectively
        /// turns it into a parent node. Only intended to be called on a
        /// degenerate node.
        /// </summary>
        /// <remarks>
        /// This allows us to enforce the invariant that we should have either
        /// two non-null children or two null children.
        /// </remarks>
        /// <param name="left">The left child.</param>
        /// <param name="right">The right child.</param>
        public void SetChildren(BspNode left, BspNode right)
        {
            Debug.Assert(IsDegenerate, "Can only set children post-construction for a degenerate node (otherwise we violate property invariants)");

            Left  = left;
            Right = right;
        }
예제 #2
0
 /// <summary>
 /// Creates a parent node from some split.
 /// </summary>
 /// <param name="left">The left child.</param>
 /// <param name="right">The right child.</param>
 /// <param name="splitter">The splitter that divided the children.
 /// </param>
 public BspNode(BspNode left, BspNode right, BspSegment splitter)
 {
     Left     = left;
     Right    = right;
     Splitter = splitter;
 }