code: public Result<float[]> closestPointOnPolyBoundary(long ref, float[] pos) {
  
          Result<Tupple2<MeshTile, Poly>> tileAndPoly = m_nav.getTileAndPolyByRef(ref);
          if (tileAndPoly.failed()) {
              return Result.of(tileAndPoly.status, tileAndPoly.message);
          }
          MeshTile tile = tileAndPoly.result.first;
          Poly poly = tileAndPoly.result.second;
          if (tile == null) {
              return Result.invalidParam("Invalid tile");
          }
  
          if (Objects.isNull(pos) || !vIsFinite(pos)) {
              return Result.invalidParam();
          }
          // Collect vertices.
          float[] verts = new float[m_nav.getMaxVertsPerPoly() * 3];
          float[] edged = new float[m_nav.getMaxVertsPerPoly()];
          float[] edget = new float[m_nav.getMaxVertsPerPoly()];
          int nv = poly.vertCount;
          for (int i = 0; i < nv; ++i) {
              System.arraycopy(tile.data.verts, poly.verts[i] * 3, verts, i * 3, 3);
          }
  
          float[] closest;
          if (distancePtPolyEdgesSqr(pos, verts, nv, edged, edget)) {
              closest = vCopy(pos);
          } else {
              // Point is outside the polygon, dtClamp to nearest edge.
              float dmin = edged[0];
              int imin = 0;
              for (int i = 1; i < nv; ++i) {
                  if (edged[i] < dmin) {
                      dmin = edged[i];
                      imin = i;
                  }
              }
              int va = imin * 3;
              int vb = ((imin + 1) % nv) * 3;
              closest = vLerp(verts, va, vb, edget[imin]);
          }
          return Result.success(closest);
      }
docs: / @returns The status flags for the query.