microsoft / automatic-graph-layout

A set of tools for graph layout and viewing
Other
1.35k stars 304 forks source link

MDS graph with Prism overlap removal => InvalidOperationException in CdtTriangle.ctor() #236

Open lafrank opened 4 years ago

lafrank commented 4 years ago

For certain graphs I observe the below error occurring in MDS graph Prism overlap removal process, The error occures in CdtTriangle when is called for 3 points spanning a line instead of a triangle, hence orientation is Collinear and InvalidOperation exception is thrown :

image

The issue is specific for Prism overlap removal. Using MinmalSpanningTree it works correctly. Unfortunately this leads to an unrecoverable error and graph rendering stops. Could you please suggest some way how to fix this ? Or any clue why is this happening ?

See call stack below:

Microsoft.Msagl.dll!Microsoft.Msagl.Routing.ConstrainedDelaunayTriangulation.CdtTriangle.CdtTriangle(Microsoft.Msagl.Routing.CdtSite a, Microsoft.Msagl.Routing.CdtSite b, Microsoft.Msagl.Routing.CdtSite c, System.Func<Microsoft.Msagl.Routing.CdtSite, Microsoft.Msagl.Routing.CdtSite, Microsoft.Msagl.Routing.CdtEdge> createEdgeDelegate) Line 26 C# Microsoft.Msagl.dll!Microsoft.Msagl.Routing.ConstrainedDelaunayTriangulation.CdtSweeper.CdtSweeper(System.Collections.Generic.List listOfSites, Microsoft.Msagl.Routing.CdtSite p_1, Microsoft.Msagl.Routing.CdtSite p_2, System.Func<Microsoft.Msagl.Routing.CdtSite, Microsoft.Msagl.Routing.CdtSite, Microsoft.Msagl.Routing.CdtEdge> createEdgeDelegate) Line 29 C# Microsoft.Msagl.dll!Microsoft.Msagl.Routing.ConstrainedDelaunayTriangulation.Cdt.SweepAndFinalize() Line 160 C# Microsoft.Msagl.dll!Microsoft.Msagl.Routing.ConstrainedDelaunayTriangulation.Cdt.RunInternal() Line 155 C# Microsoft.Msagl.dll!Microsoft.Msagl.Core.AlgorithmBase.Run() Line 24 C# Microsoft.Msagl.dll!Microsoft.Msagl.Core.Layout.ProximityOverlapRemoval.ProximityOverlapRemoval.DoSingleIteration(int currentIteration, ref bool scanlinePhase) Line 389 C# Microsoft.Msagl.dll!Microsoft.Msagl.Core.Layout.ProximityOverlapRemoval.ProximityOverlapRemoval.RemoveOverlaps() Line 337 C# Microsoft.Msagl.dll!Microsoft.Msagl.Core.Layout.ProximityOverlapRemoval.ProximityOverlapRemoval.RemoveOverlaps(Microsoft.Msagl.Core.Layout.GeometryGraph geometryGraph, double nodeSeparation) Line 725 C# Microsoft.Msagl.dll!Microsoft.Msagl.Layout.MDS.MdsGraphLayout.LayoutConnectedGraphWithMds(Microsoft.Msagl.Core.Layout.GeometryGraph compGraph) Line 220 C#

Thank you !