code: public Result<FindNearestPolyResult> findNearestPoly(float[] center, float[] halfExtents, QueryFilter filter) {
  
          float[] nearestPt = new float[] {center[0], center[1], center[2]};
  
          // Get nearby polygons from proximity grid.
          Result<List<Long>> polysResult = queryPolygons(center, halfExtents, filter);
          if (polysResult.failed()) {
              return Result.of(polysResult.status, polysResult.message);
          }
          List<Long> polys = polysResult.result;
          // Find nearest polygon amongst the nearby polygons.
          long nearest = 0;
          float nearestDistanceSqr = Float.MAX_VALUE;
          for (int i = 0; i < polys.size(); ++i) {
              long ref = polys.get(i);
              Result<ClosestPointOnPolyResult> closest = closestPointOnPoly(ref, center);
              boolean posOverPoly = closest.result.isPosOverPoly();
              float[] closestPtPoly = closest.result.getClosest();
  
              // If a point is directly over a polygon and closer than
              // climb height, favor that instead of straight line nearest point.
              float d = 0;
              float[] diff = vSub(center, closestPtPoly);
              if (posOverPoly) {
                  Tupple2<MeshTile, Poly> tilaAndPoly = m_nav.getTileAndPolyByRefUnsafe(polys.get(i));
                  MeshTile tile = tilaAndPoly.first;
                  d = Math.abs(diff[1]) - tile.data.header.walkableClimb;
                  d = d > 0 ? d * d : 0;
              } else {
                  d = vLenSqr(diff);
              }
  
              if (d < nearestDistanceSqr) {
                  nearestPt = closestPtPoly;
                  nearestDistanceSqr = d;
                  nearest = ref;
              }
          }
  
          return Result.success(new FindNearestPolyResult(nearest, nearestPt));
      }
docs: / @returns The status flags for the query.