Exemple #1
0
 void CreateScanSegments(Obstacle obstacle, NeighborSides neighborSides, BasicVertexEvent vertexEvent)
 {
     this.CreateScanSegments(obstacle, (HighObstacleSide)neighborSides.LowNeighbor.Item
                             , (null == neighborSides.LowOverlapEnd) ? null : neighborSides.LowOverlapEnd.Item
                             , (null == neighborSides.HighOverlapEnd) ? null : neighborSides.HighOverlapEnd.Item
                             , (LowObstacleSide)neighborSides.HighNeighbor.Item, vertexEvent);
 }
        void SkipToNeighbor(Directions nborSearchDir, BasicObstacleSide side, Point sideReferencePoint,
                            RBNode<BasicObstacleSide> nborNode, NeighborSides neighborSides) {
            // Find the first neighbor side (LowObstacleSide if going high, HighObstacleSide if going low) and
            // the side of opposite type (which would potentially end overlap), that that we cross *through*, if any.
            RBNode<BasicObstacleSide> overlapSideNode = null;
            BasicObstacleSide interveningGroupSide = null;
            for (; ; nborNode = scanLine.Next(nborSearchDir, nborNode)) {
                // Ignore the opposite side of the current obstacle.
                if (nborNode.Item.Obstacle == side.Obstacle) {
                    continue;
                }

                if (nborNode.Item.Obstacle.IsGroup) {
                    if (ProcessGroupSideEncounteredOnTraversalToNeighbor(nborNode, sideReferencePoint, nborSearchDir)) {
                        // Keep the first one (outermost) encountered.
                        if (null == interveningGroupSide) {
                            interveningGroupSide = nborNode.Item;
                        }
                    }
                    continue;
                }

                // Check for overlap-ending obstacle.
                if ((nborNode.Item is HighObstacleSide) == StaticGraphUtility.IsAscending(nborSearchDir)) {
                    if (ScanLineCrossesObstacle(sideReferencePoint, nborNode.Item.Obstacle)) {
                        overlapSideNode = nborNode;
                        interveningGroupSide = null;
                    }
                    continue;
                }

                // If we're here, we found the neighbor we were looking for.
                break;
            }

            neighborSides.SetSides(nborSearchDir, nborNode, overlapSideNode, interveningGroupSide);
        }
 protected void FindNeighbors(BasicVertexEvent vertexEvent, RBNode<BasicObstacleSide> sideNode, NeighborSides neighborSides) {
     // vertexEvent.Site is on one of vertexEvent.Obstacle.Active(Low|High)Side, so we must get the 
     // appropriate vertex on whichever one of those Active*Sides is sideNode.
     var sideReferencePoint = (vertexEvent is OpenVertexEvent) ? sideNode.Item.Start : sideNode.Item.End;
     RBNode<BasicObstacleSide> initialLowNbor, initialHighNbor;
     this.FindInitialNeighborSides(sideNode, out initialLowNbor, out initialHighNbor);
     this.SkipToNeighbor(this.ScanDirection.OppositeDirection, sideNode.Item, sideReferencePoint, initialLowNbor, neighborSides);
     this.SkipToNeighbor(this.ScanDirection.Direction, sideNode.Item, sideReferencePoint, initialHighNbor, neighborSides);
 }
 void CreateScanSegments(Obstacle obstacle, NeighborSides neighborSides, BasicVertexEvent vertexEvent) {
     this.CreateScanSegments(obstacle, (HighObstacleSide)neighborSides.LowNeighbor.Item
                             , (null == neighborSides.LowOverlapEnd) ? null : neighborSides.LowOverlapEnd.Item
                             , (null == neighborSides.HighOverlapEnd) ? null : neighborSides.HighOverlapEnd.Item
                             , (LowObstacleSide)neighborSides.HighNeighbor.Item, vertexEvent);
 }