Main Content

closestProjections

Find orthogonal projections between path tangent vector and query point

    Description

    [arclengths,distances] = closestProjections(refPath,points) attempts to project each xy point in the points matrix, onto each clothoid segment contained in the reference path, refPath, such that the projection vector is orthogonal to the path tangent-angle. Returns closest orthogonal projection between the curve and query point in each segment as a pair of two cell arrays, arclengths and distances containing the arclengths and distances respectively.

    [___,projPoints] = closestProjections(refPath,points) optionally returns the projected points, projPoints as a cell array containing path data evaluated at the corresponding arclengths element.

    [___] = closestProjections(refPath,points,bestN) returns the nearest projections, bestNfor each xy point in points.

    [___] = closestProjections(refPath,points,intervals) accepts an optional matrix of arclengths intervals, intervals, where each row contains a lower and upper arclength bounds.

    [___] = closestProjections(refPath,points,intervals,bestN) returns up to the nearest projections bestN for each xy point in points.

    Input Arguments

    collapse all

    Reference path, specified as a referencePathFrenet object.

    Global points, specified as a P-by-2 numeric matrix with rows of the form [x y]. P is the number of points. Positions are in meters.

    Best N projections, specified as a scalar in the range [1,N], where N is the number of segments in the path.

    Arclength intervals, specified as a N-by-2 matrix, where each row is of the form [minimum_arclength, maximum_arclength] in meters, and N is the number of segments in the path.

    Output Arguments

    collapse all

    Arclengths between curve and query points, returned as an M-element cell array, where M is the number of query points in the points input. Each cell contains a P-element column vector, where P is in the range [0,N] and N is the number of segments in the path.

    Distances between curve and query points, returned as an M-element cell array, where M is the number of query points in the points input. Each cell contains a P-element column vector, where P is in the range [0,N] and N is the number of segments in the path.

    Projected points, returned as an M-element cell array, where M is the number of query points in the points input. Each cell contains a P-by-6 matrix, where P is in the range [0,N] and each row is in the form [x y theta k dk s]. x, y, theta, k, dk, s, are the x and y positions, tangent angle, curvature, change in curvature, at the arclength, s, respectively.

    Extended Capabilities

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

    Version History

    Introduced in R2022a