I have done so, but it doesn't seem to work (maybe I'm misusing it?); observe that the connection between Lehman and Orillia on the right overlaps with another connection.
Here is a map, and here is a code snippet that is used when generating the map.
I know there won't be overlaps from just the spanning tree, so these overlaps have to come
from the random connections code, but the random connections code uses your GetWouldLinkCrossOverOtherPlanets function.
//Two potential planets are selected for random connections (neither has
//a random connection yet)
//Lets make sure a link there does not cause any overlap in lines
Planet firstPlanet = planetsForMap[firstPlanetIdx];
Planet secondPlanet = planetsForMap[secondPlanetIdx];
bool wouldLinkCrossOtherPlanets = UtilityMethods.GetWouldLinkCrossOverOtherPlanets(firstPlanet, secondPlanet);
if(wouldLinkCrossOtherPlanets)
{
i--; //discard this pair, since there's an overlap
}
else
{
firstPlanet.AddLinkTo(secondPlanet);
usedPlanetsForConnections.Add(firstPlanetIdx);
usedPlanetsForConnections.Add(secondPlanetIdx);
}
When I look at your code, I see
if ( Mat.LineIntersectsRectangleContainingCircle( First.GalaxyLocation, Second.GalaxyLocation,
planetToNotHit.GalaxyLocation,
planetToNotHit.TypeData.IntraStellarRadius ) )
It looks like this says "Make sure the ensuing line does not intersect a planet body, not a connection", but I could easily be misreading this (I can't see the Mat class to check).