@Test public void testFindPath() { PolygonPointPath pointPath=new PolygonPointPath(); List<Vector3> paths = navMesh.findPath(new Vector3(168.7f,25.3f, 197.4f), new Vector3(159.7f,25.4f,199.2f), pointPath); if(paths!=null) { paths.forEach(p->System.out.println(p.toString())); } }
public boolean findPath(Vector3 fromPoint, Vector3 toPoint, PolygonGraphPath path) { path.clear(); Polygon fromPolygon = getPolygon(fromPoint); Polygon toPolygon; if (fromPolygon != null && fromPolygon.isInnerPoint(toPoint)) { toPolygon = fromPolygon; } else { toPolygon = getPolygon(toPoint); } if(fromPolygon==null) { LOGGER.warn("起始坐标：{}不在寻路层中",fromPoint.toString()); return false; } if(toPolygon==null) { LOGGER.warn("终点坐标：{}不在寻路层中",toPoint.toString()); return false; } if (pathFinder.searchConnectionPath(fromPolygon, toPolygon, heuristic, path)) { path.start = new Vector3(fromPoint); path.end = new Vector3(toPoint); path.startPolygon = fromPolygon; return true; } return false; }
PolygonNavMesh extends NavMesh { public boolean findPath(Vector3 fromPoint, Vector3 toPoint, PolygonGraphPath path) { path.clear(); Polygon fromPolygon = getPolygon(fromPoint); Polygon toPolygon; if (fromPolygon != null && fromPolygon.isInnerPoint(toPoint)) { toPolygon = fromPolygon; } else { toPolygon = getPolygon(toPoint); } if(fromPolygon==null) { LOGGER.warn("起始坐标：{}不在寻路层中",fromPoint.toString()); return false; } if(toPolygon==null) { LOGGER.warn("终点坐标：{}不在寻路层中",toPoint.toString()); return false; } if (pathFinder.searchConnectionPath(fromPolygon, toPolygon, heuristic, path)) { path.start = new Vector3(fromPoint); path.end = new Vector3(toPoint); path.startPolygon = fromPolygon; return true; } return false; } }
PolygonNavMesh extends NavMesh { public boolean findPath(Vector3 fromPoint, Vector3 toPoint, PolygonGraphPath path) { path.clear(); Polygon fromPolygon = getPolygon(fromPoint); Polygon toPolygon; if (fromPolygon != null && fromPolygon.isInnerPoint(toPoint)) { toPolygon = fromPolygon; } else { toPolygon = getPolygon(toPoint); } if(fromPolygon==null) { LOGGER.warn("起始坐标：{}不在寻路层中",fromPoint.toString()); return false; } if(toPolygon==null) { LOGGER.warn("终点坐标：{}不在寻路层中",toPoint.toString()); return false; } if (pathFinder.searchConnectionPath(fromPolygon, toPolygon, heuristic, path)) { path.start = new Vector3(fromPoint); path.end = new Vector3(toPoint); path.startPolygon = fromPolygon; return true; } return false; } PolygonNavMesh(String navMeshStr);  PolygonNavMesh(String navMeshStr, int scale); }
PolygonNavMesh extends NavMesh { public boolean findPath(Vector3 fromPoint, Vector3 toPoint, PolygonGraphPath path) { path.clear(); Polygon fromPolygon = getPolygon(fromPoint); Polygon toPolygon; if (fromPolygon != null && fromPolygon.isInnerPoint(toPoint)) { toPolygon = fromPolygon; } else { toPolygon = getPolygon(toPoint); } if(fromPolygon==null) { LOGGER.warn("起始坐标：{}不在寻路层中",fromPoint.toString()); return false; } if(toPolygon==null) { LOGGER.warn("终点坐标：{}不在寻路层中",toPoint.toString()); return false; } if (pathFinder.searchConnectionPath(fromPolygon, toPolygon, heuristic, path)) { path.start = new Vector3(fromPoint); path.end = new Vector3(toPoint); path.startPolygon = fromPolygon; return true; } return false; } PolygonNavMesh(String navMeshStr);  PolygonNavMesh(String navMeshStr, int scale); boolean findPath(Vector3 fromPoint, Vector3 toPoint, PolygonGraphPath path); List<Vector3> findPath(Vector3 fromPoint, Vector3 toPoint, PolygonPointPath pointPath); List<Vector3> find3DPath(Vector3 fromPoint, Vector3 toPoint, PolygonPointPath pointPath); Polygon getPolygon(Vector3 point); @Override Vector3 getPointInPath(float x, float z); Polygon getRectangle(Vector3 position, float distance, Vector3 sourceDirection, float width, float height); final Polygon getSector(Vector3 position, Vector3 sourceDirection, float distance, float radius,
			float degrees); final Polygon getNPolygon(Vector3 center, float radius, int vertexCount); @Override List<Vector3> getRandomPointsInPath(Vector3 center, float radius, float minDisToCenter); @Override Vector3 getRandomPointInPath(Vector3 center, float radius, float minDisToCenter); PolygonGraph getGraph(); }
PolygonNavMesh extends NavMesh { public boolean findPath(Vector3 fromPoint, Vector3 toPoint, PolygonGraphPath path) { path.clear(); Polygon fromPolygon = getPolygon(fromPoint); Polygon toPolygon; if (fromPolygon != null && fromPolygon.isInnerPoint(toPoint)) { toPolygon = fromPolygon; } else { toPolygon = getPolygon(toPoint); } if(fromPolygon==null) { LOGGER.warn("起始坐标：{}不在寻路层中",fromPoint.toString()); return false; } if(toPolygon==null) { LOGGER.warn("终点坐标：{}不在寻路层中",toPoint.toString()); return false; } if (pathFinder.searchConnectionPath(fromPolygon, toPolygon, heuristic, path)) { path.start = new Vector3(fromPoint); path.end = new Vector3(toPoint); path.startPolygon = fromPolygon; return true; } return false; } PolygonNavMesh(String navMeshStr);  PolygonNavMesh(String navMeshStr, int scale); boolean findPath(Vector3 fromPoint, Vector3 toPoint, PolygonGraphPath path); List<Vector3> findPath(Vector3 fromPoint, Vector3 toPoint, PolygonPointPath pointPath); List<Vector3> find3DPath(Vector3 fromPoint, Vector3 toPoint, PolygonPointPath pointPath); Polygon getPolygon(Vector3 point); @Override Vector3 getPointInPath(float x, float z); Polygon getRectangle(Vector3 position, float distance, Vector3 sourceDirection, float width, float height); final Polygon getSector(Vector3 position, Vector3 sourceDirection, float distance, float radius,
			float degrees); final Polygon getNPolygon(Vector3 center, float radius, int vertexCount); @Override List<Vector3> getRandomPointsInPath(Vector3 center, float radius, float minDisToCenter); @Override Vector3 getRandomPointInPath(Vector3 center, float radius, float minDisToCenter); PolygonGraph getGraph();  }