Search in sources :

Example 6 with VisibilityGraph

use of org.opentripplanner.visibility.VisibilityGraph in project OpenTripPlanner by opentripplanner.

the class TestVisibilityGraph method testSquareCenteredInSquare.

public void testSquareCenteredInSquare() {
    Environment environment = new Environment(Arrays.asList(poly(1, 1, 5, 1, 5, 5, 1, 5), poly(2, 3.5, 2, 4.5, 3, 4.5, 3, 3.5)));
    environment.enforce_standard_form();
    VisibilityGraph vg = new VisibilityGraph(environment, 0.01);
    boolean[][] expected = { { true, true, true, true, true, true, false, true }, { true, true, true, false, true, false, true, true }, { true, true, true, true, false, true, true, true }, { true, false, true, true, true, true, true, false }, { true, true, false, true, true, true, false, true }, { true, false, true, true, true, true, true, false }, { false, true, true, true, false, true, true, true }, { true, true, true, false, true, false, true, true } };
    for (int i = 0; i < expected.length; ++i) {
        for (int j = 0; j < expected[i].length; ++j) {
            assertEquals("difference at " + i + ", " + j, expected[i][j], vg.get(i, j));
        }
    }
}
Also used : Environment(org.opentripplanner.visibility.Environment) VisibilityGraph(org.opentripplanner.visibility.VisibilityGraph) VLPoint(org.opentripplanner.visibility.VLPoint)

Aggregations

Environment (org.opentripplanner.visibility.Environment)6 VLPoint (org.opentripplanner.visibility.VLPoint)6 VisibilityGraph (org.opentripplanner.visibility.VisibilityGraph)6 VLPolygon (org.opentripplanner.visibility.VLPolygon)4