Main Content

gradient

Find gradient for query points in 3-D signed distance map

Since R2024b

    Description

    grad = gradient(sdm3D,points) finds the gradient from voxels in the vicinity of the specified query points in the 3-D signed distance field.

    grad = gradient(sdm3D,points,InterpolationMethod=interp) specifies the method to use to interpolate the distance field.

    Input Arguments

    collapse all

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

    Example: signedDistanceMap(Resolution=2) creates a 3-D signed distance map with a grid resolution of 2 cells per meter.

    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 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, 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 R2024b