private Discrete2D?EndSegmentAtFreeEnd(Discrete2D?current, SegmentNode segment, Discrete2D neighbour) { // End segment here by adding last node Debug.Assert(current.HasValue); Point2D currentGeographic = GridToGeographic(current.Value.I, current.Value.J); segment.Add(currentGeographic); Point2D neighbourGeographic = GridToGeographic(neighbour.I, neighbour.J); segment.Add(neighbourGeographic); segment.NextBranch = null; MarkVisited(current.Value); MarkVisited(neighbour); return(null); }
private Discrete2D?AppendToSegment(Discrete2D?current, SegmentNode segment, Discrete2D neighbour) { // Add a point to the segment, and move on Debug.Assert(current.HasValue); Debug.Assert(IsStem(neighbour)); Point2D currentGeographic = GridToGeographic(current.Value.I, current.Value.J); segment.Add(currentGeographic); MarkVisited(current.Value); return(neighbour); }
private Discrete2D?EndSegmentAtJunction(Component component, Discrete2D?current, SegmentNode segment, Discrete2D junction) { // End segment here with edge to junction Debug.Assert(current.HasValue); BranchNode branchPoint = component.junctions[junction]; Point2D geographic = GridToGeographic(current.Value.I, current.Value.J); segment.Add(geographic); segment.NextBranch = branchPoint; MarkVisited(current.Value); return(null); }