Main Content


Compute distance to zero level set for query points

Since R2024a


    dist = distance(mTSDF,points) returns the distance from the specified query points to each voxel in the truncated signed distance field (TSDF). If a voxel lies outside of the truncation distance radius of a query point, then the distance of the query point is equal to the truncation distance.

    dist = distance(mTSDF,points,InterpolationMethod=interp) specifies the method to use for interpolating the distance values of nearby voxels.

    Input Arguments

    collapse all

    Truncated signed distance field for 3-D meshes, specified as a meshtsdf object.

    Example: meshtsdf(meshes,TruncationDistance=5) creates a TSDF for the specified meshes with a truncation distance of 5 meters.

    Query points, specified as an N-by-3 matrix, where each row represents an xyz point. N is the total number of query points.

    Interpolation method, specified as one of these options:

    • "nearest" — Use distance stored in the voxel at each query point in points.

    • "linear" — Use trilinear interpolation to compute the distance using the eight voxels surrounding each query point in points.

    • "quadratic" — Use quadratic interpolation to compute distance using the 27 voxels surrounding each query point in points.

    Output Arguments

    collapse all

    Distance values of voxel at each query point, specified as an N-element vector. N is the total number of query points specified in points.

    By default, distance returns the distance value stored in the nearest voxel at each query point. Use the interp argument to use a different interpolation method.

    Extended Capabilities

    C/C++ Code Generation
    Generate C and C++ code using MATLAB® Coder™.

    Version History

    Introduced in R2024a

    See Also