Main Content

distance

Find distance to zero-level set for query points

Since R2024b

    Description

    dist = distance(sdm3D,points) returns the distance computed from the discrete distances in the signed distance field for each of the specified query points. If the query point belongs to a voxel that is a distance further than sdm3D.TruncationDistance from the iso-voxels of a discretized mesh, then the distance value of the query point is limited to sdm3D.TruncationDistance. If a query point lies inside the mesh and sdm3D.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(sdm3D,points,InterpolationMethod=interp) specifies the method to use to interpolate the distance values of nearby voxels.

    Input Arguments

    collapse all

    3-D signed distance map, specified as a signedDistanceMap3D object.

    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 27 voxels surrounding each query point in points.

    • "quadratic" — Use quadratic interpolation to compute the distance using the 624 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 R2024b