public Result<Float> getPolyHeight(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 (Objects.isNull(pos) || !vIsFinite2D(pos)) {
            return Result.invalidParam();
        }

        // We used to return success for offmesh connections, but the
        // getPolyHeight in DetourNavMesh does not do this, so special
        // case it here.
        if (poly.getType() == Poly.DT_POLYTYPE_OFFMESH_CONNECTION) {
            int i = poly.verts[0] * 3;
            float[] v0 = new float[] { tile.data.verts[i], tile.data.verts[i + 1], tile.data.verts[i + 2] };
            i = poly.verts[1] * 3;
            float[] v1 = new float[] { tile.data.verts[i], tile.data.verts[i + 1], tile.data.verts[i + 2] };
            Tupple2<Float, Float> dt = distancePtSegSqr2D(pos, v0, v1);
            return Result.success(v0[1] + (v1[1] - v0[1]) * dt.second);
        }
        Optional<Float> height = m_nav.getPolyHeight(tile, poly, pos);
        return height.isPresent() ? Result.success(height.get()) : Result.invalidParam();
    }
public Result < Float > getPolyHeight ( 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 ( Objects . isNull ( pos ) || ! vIsFinite2D ( pos ) ) { return Result . invalidParam ( ) ; } if ( poly . getType ( ) == Poly . DT_POLYTYPE_OFFMESH_CONNECTION ) { int i = poly . verts [ 0 ] * 3 ; float [ ] v0 = new float [ ] { tile . data . verts [ i ] , tile . data . verts [ i + 1 ] , tile . data . verts [ i + 2 ] } ; i = poly . verts [ 1 ] * 3 ; float [ ] v1 = new float [ ] { tile . data . verts [ i ] , tile . data . verts [ i + 1 ] , tile . data . verts [ i + 2 ] } ; Tupple2 < Float , Float > dt = distancePtSegSqr2D ( pos , v0 , v1 ) ; return Result . success ( v0 [ 1 ] + ( v1 [ 1 ] - v0 [ 1 ] ) * dt . second ) ; } Optional < Float > height = m_nav . getPolyHeight ( tile , poly , pos ) ; return height . isPresent ( ) ? Result . success ( height . get ( ) ) : Result . invalidParam ( ) ; }
/ @returns The status flags for the query.