Skip to content

Automatic detection of line orientation when computing the visibility graph

Concerned Class/Method

  • Package: de.geoinfobonn.traveltimemaps.schematicmorph.visibilityGraph
  • Class: GeodesicDistanceCalculator
  • Method: VisibilityGraph computeVisibilityGraph()

Current Behavior

Concavity is always defined as left turn, convexity as right turn. This is only true if l1 is "left of" l2. Otherwise, the definition must be changed. Until now, this is not checked and thus the distance computation is wrong in case l1 is right of l2.

Expected Behavior

Determine the orientation of l1 and l2 automatically and use the result.

Ideas to Fix

Check orientation of l1 and l2 and, if needed, swap the function calls to precompute concavity/convexity:

boolean[] concaveL1 = GeometricUtils.precomputeConcavity(l1);
boolean[] convexL2 = GeometricUtils.precomputeConvexity(l2);