private void ExecuteConvexityCheck() { Debug.Assert(workItems.Count < RecursiveOverflowAmount, "BSP recursive overflow detected"); switch (ConvexChecker.States.State) { case ConvexState.Loaded: case ConvexState.Traversing: ConvexChecker.Execute(); break; case ConvexState.FinishedIsDegenerate: foundDegenerateNode = true; goto case ConvexState.FinishedIsConvex; case ConvexState.FinishedIsConvex: State = BspState.CreatingLeafNode; break; case ConvexState.FinishedIsSplittable: WorkItem workItem = workItems.Peek(); SplitCalculator.Load(workItem.Segments); State = BspState.FindingSplitter; break; } }
private void LoadNextWorkItem() { Debug.Assert(workItems.Count > 0, "Expected a root work item to be present"); ConvexChecker.Load(workItems.Peek().Segments); State = BspState.CheckingConvexity; }
private void ExecuteMinisegGeneration() { switch (MinisegCreator.States.State) { case MinisegState.Loaded: case MinisegState.Working: MinisegCreator.Execute(); break; case MinisegState.Finished: State = BspState.FinishingSplit; break; } }
private void ExecuteSplitterFinding() { switch (SplitCalculator.States.State) { case SplitterState.Loaded: case SplitterState.Working: SplitCalculator.Execute(); break; case SplitterState.Finished: Partitioner.Load(SplitCalculator.States.BestSplitter, workItems.Peek().Segments); State = BspState.PartitioningSegments; break; } }
/// <summary> /// Advances to the next major state. /// </summary> public void ExecuteMajorStep() { if (Done) { return; } BspState originalState = State; BspState currentState = State; while (originalState == currentState && !Done) { Execute(); currentState = State; } }
private void ExecuteSegmentPartitioning() { switch (Partitioner.States.State) { case PartitionState.Loaded: case PartitionState.Working: Partitioner.Execute(); break; case PartitionState.Finished: if (Partitioner.States.Splitter == null) { throw new NullReferenceException("Unexpected null partition splitter"); } BspSegment splitter = Partitioner.States.Splitter; MinisegCreator.Load(splitter, Partitioner.States.CollinearVertices); State = BspState.GeneratingMinisegs; break; } }
private void ExecuteLeafNodeCreation() { ConvexState convexState = ConvexChecker.States.State; Debug.Assert(convexState == ConvexState.FinishedIsDegenerate || convexState == ConvexState.FinishedIsConvex, "Unexpected BSP leaf building state"); if (convexState == ConvexState.FinishedIsConvex) { AddConvexTraversalToTopNode(); } workItems.Pop(); if (workItems.Empty()) { State = BspState.Complete; } else { LoadNextWorkItem(); } }