private VisibilityEdge AddVisibilityEdge(VisibilityVertex source, VisibilityVertex target) { Debug.Assert(source.Point != target.Point, "Self-edges are not allowed"); Debug.Assert(PointComparer.IsPureLower(source.Point, target.Point), "Impure or reversed direction encountered"); // Make sure we aren't adding two edges in the same direction to the same vertex. Debug.Assert(null == StaticGraphUtility.FindNextVertex(source, StaticGraphUtility.EdgeDirection(source, target)) , "Duplicate outEdge from Source vertex"); Debug.Assert(null == StaticGraphUtility.FindNextVertex(target, StaticGraphUtility.EdgeDirection(target, source)) , "Duplicate inEdge to Target vertex"); var edge = new VisibilityEdge(source, target, this.Weight); VisibilityGraph.AddEdge(edge); return(edge); }
// ReSharper restore InconsistentNaming private VisibilityEdge CreateEdge(VisibilityVertex first, VisibilityVertex second, double weight) { // All edges in the graph are ascending. VisibilityVertex source = first; VisibilityVertex target = second; if (!PointComparer.IsPureLower(source.Point, target.Point)) { source = second; target = first; } var edge = new TollFreeVisibilityEdge(source, target, weight); VisibilityGraph.AddEdge(edge); this.AddedEdges.Add(edge); return(edge); }