PolygonNavMesh extends NavMesh { @Override public List<Vector3> getRandomPointsInPath(Vector3 center, float radius, float minDisToCenter) { int x = (int) center.x; int z = (int) center.z; int offset = (int) Math.ceil(radius); List<Vector3> targets = new ArrayList<>(); Set<Entry<Integer, Map<Integer, List<Vector3>>>> entrySet = this.graph.getAllRandomPointsInPath().entrySet(); for(Entry<Integer, Map<Integer, List<Vector3>>> entry:entrySet) { if(Math.abs(entry.getKey().intValue() - x) <= offset) { Set<Entry<Integer, List<Vector3>>> entrySet2 = entry.getValue().entrySet(); for(Entry<Integer, List<Vector3>> entry2:entrySet2) { if(Math.abs(entry2.getKey()-z)<=radius) { targets.addAll(entry2.getValue()); } } } } return targets; } 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();  }
@Test public void testFindRandomPointInPath() { long begin=TimeUtil.currentTimeMillis(); for(int i=0;i<10000;i++) { navMesh.getRandomPointsInPath(new Vector3(205,19,113), 5f, 0.2f); } System.out.println("耗时："+(TimeUtil.currentTimeMillis()-begin)); }