use of org.opentripplanner.visibility.Environment in project OpenTripPlanner by opentripplanner.
the class TestVisibilityGraph method testPalazzo.
// Another Venice test case
public void testPalazzo() {
VLPolygon poly = poly(12.3402039, 45.4342526, 12.339956, 45.43421, 12.3401159, 45.4338161, 12.3404923, 45.4338996, 12.3402845, 45.4344296, 12.3402433, 45.4344174, 12.3401433, 45.4343973, 12.3401691, 45.4343433);
Environment environment = new Environment(Arrays.asList(poly));
environment.enforce_standard_form();
VisibilityGraph vg = new VisibilityGraph(environment, 0.0000001);
boolean[][] expected = { { true, true, true, false, false, false, false, true }, { true, true, true, true, true, false, false, true }, { true, true, true, true, true, true, true, true }, { false, true, true, true, true, false, true, true }, { false, true, true, true, true, true, true, true }, { false, false, true, false, true, true, true, false }, { false, false, true, true, true, true, true, true }, { true, true, true, true, true, false, true, true } };
for (int i = 0; i < expected.length; ++i) {
for (int j = 0; j < expected[i].length; ++j) {
assertEquals(" at " + i + ", " + j, expected[i][j], vg.get(i, j));
}
}
}
use of org.opentripplanner.visibility.Environment 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));
}
}
}
Aggregations