Main Content


Compute gradient of truncated signed distance field

Since R2024a


    grad = gradient(mTSDF,points) returns the gradient voxels in the vicinity of the specified query points in the truncated signed distance field (TSDF).

    grad = gradient(mTSDF,points,InterpolationMethod=interp) specifies the method to use for interpolating the distance field.

    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:

    • "linear" — Compute the partial derivatives of the trilinearly-interpolated distance field.

    • "quadratic" — Compute the partial derivatives of the triquadratically-interpolated distance field.

    Output Arguments

    collapse all

    Gradient 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, gradient uses the linear interpolation method to determine the gradient. Use the interp argument to change the interpolation method.

    Extended Capabilities

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

    Version History

    Introduced in R2024a

    See Also