Main Content

distance

Compute distance to zero level set for query points

Since R2024a

    Description

    dist = distance(mTSDF,points) returns the distance computed from the discrete distances in the truncated signed distance field (TSDF) for each of the specified query points. If the query point belongs to a voxel that is a distance further than mTSDF.TruncationDistance from the iso-voxels of a discretized mesh, then the distance value of the query point is limited to mTSDF.TruncationDistance. If a query point lies inside the mesh and mTSDF.FillInterior is true, then the distance value is computed from the distance values stored around the query point based on the interpolation method chosen.

    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 value of the voxel at each query point, returned 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. Specify 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

    |