Skip to content

Commit

Permalink
Fix VisiiblityInspector's use of cover VBL
Browse files Browse the repository at this point in the history
The tool doesn't like `null` topology, so instead make sure cover VBL is empty.
  • Loading branch information
kwvanderlinde committed Nov 24, 2023
1 parent a7a0061 commit 2f96c36
Showing 1 changed file with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ public VisibilityInspector() {
wallVblTree = new AreaTree(new Area());
hillVblTree = new AreaTree(new Area());
pitVblTree = new AreaTree(new Area());
coverVblTree = new AreaTree(new Area());
affineTransform = new AffineTransform();
point = new Point(0, 0);
visionRange = 200;
Expand Down Expand Up @@ -199,6 +200,7 @@ private static void buildRepeatedSquaredTopology(VisibilityInspector visibilityI
Area wallArea = new Area();
Area hillArea = new Area();
Area pitArea = new Area();
Area coverArea = new Area();
wallArea.add(new Area(new Rectangle(0, 0, 750, 750)));
wallArea.subtract(new Area(new Rectangle(50, 50, 650, 650)));
for (int x = 1; x < 7; ++x) {
Expand All @@ -217,33 +219,35 @@ private static void buildRepeatedSquaredTopology(VisibilityInspector visibilityI
}
}
}
visibilityInspector.setTopology(wallArea, hillArea, pitArea, null);
visibilityInspector.setTopology(wallArea, hillArea, pitArea, coverArea);
}

private static void buildTripleIntersectionTopology(VisibilityInspector visibilityInspector) {
Area wallArea = new Area();
Area hillArea = new Area();
Area pitArea = new Area();
Area coverArea = new Area();
wallArea.add(new Area(new Rectangle(0, 0, 750, 750)));
wallArea.subtract(new Area(new Rectangle(50, 50, 650, 650)));

wallArea.add(new Area(new Polygon(new int[] {250, 450, 450}, new int[] {250, 450, 250}, 3)));
hillArea.add(new Area(new Polygon(new int[] {250, 450, 450}, new int[] {450, 450, 250}, 3)));
pitArea.add(new Area(new Polygon(new int[] {275, 325, 325}, new int[] {350, 150, 550}, 3)));

visibilityInspector.setTopology(wallArea, hillArea, pitArea, null);
visibilityInspector.setTopology(wallArea, hillArea, pitArea, coverArea);
}

private static void buildSinglePillarTopology(VisibilityInspector visibilityInspector) {
Area wallArea = new Area();
Area hillArea = new Area();
Area pitArea = new Area();
Area coverArea = new Area();
wallArea.add(new Area(new Rectangle(0, 0, 750, 750)));
wallArea.subtract(new Area(new Rectangle(50, 50, 650, 650)));

final var pillar = new Area(new Rectangle(300, 300, 50, 50));
wallArea.add(pillar);

visibilityInspector.setTopology(wallArea, hillArea, pitArea, null);
visibilityInspector.setTopology(wallArea, hillArea, pitArea, coverArea);
}
}

0 comments on commit 2f96c36

Please sign in to comment.