@Test public void testSimplePaths() throws Exception { float s = 10; Polygon p = new Polygon(new float[] { 0, 0, s, 0, s, s, 0, s }); PathFinder pf = new PathFinder(p, null); Vector2 tgt = new Vector2(s - 1, s - 1); assertSamePath("direct clear path in square", new Vector2[] { new Vector2(1, 1), tgt }, pf.findPath(new Vector2(1, 1), tgt)); assertSamePath("direct path in square, starting from opposite corner", new Vector2[] { new Vector2(0, 0), tgt }, pf.findPath(new Vector2(0, 0), tgt)); assertSamePath("impossible path in square (in-to-out)", new Vector2[] { new Vector2(1, s / 2), new Vector2(s, s / 2) }, pf.findPath(new Vector2(1, s / 2), new Vector2(s + s, s / 2))); assertSamePath("impossible path in square (out-to-in)", new Vector2[] { new Vector2(0, s / 2), new Vector2(2, s / 2) }, pf.findPath(new Vector2(-1, s / 2), new Vector2(2, s / 2))); }
public PathIterator findPath(Vector2 start, Vector2 finish, float step) { Array<PathPoint> pps = findPath(start, finish); return new PathIterator(pps, worldToView, step); }
PathFinder { public PathIterator findPath(Vector2 start, Vector2 finish, float step) { Array<PathPoint> pps = findPath(start, finish); return new PathIterator(pps, worldToView, step); } }
PathFinder { public PathIterator findPath(Vector2 start, Vector2 finish, float step) { Array<PathPoint> pps = findPath(start, finish); return new PathIterator(pps, worldToView, step); } PathFinder(Polygon pathBoundary, Matrix3 viewToWorld); }
PathFinder { public PathIterator findPath(Vector2 start, Vector2 finish, float step) { Array<PathPoint> pps = findPath(start, finish); return new PathIterator(pps, worldToView, step); } PathFinder(Polygon pathBoundary, Matrix3 viewToWorld); Matrix3 getViewToWorld(); Matrix3 getWorldToView(); PathIterator findPath(Vector2 start, Vector2 finish, float step); float scaleAt(Vector2 point); }
PathFinder { public PathIterator findPath(Vector2 start, Vector2 finish, float step) { Array<PathPoint> pps = findPath(start, finish); return new PathIterator(pps, worldToView, step); } PathFinder(Polygon pathBoundary, Matrix3 viewToWorld); Matrix3 getViewToWorld(); Matrix3 getWorldToView(); PathIterator findPath(Vector2 start, Vector2 finish, float step); float scaleAt(Vector2 point);  }