Main Content

dist

Calculate distance between transformations

Since R2022b

    Description

    distance = dist(transformation1,transformation2) returns the distance distance between the poses represented by transformation transformation1 and transformation transformation2.

    For the homogeneous transformation objects se2, and se3, the dist function calculates translational and rotational distance independently and combines them in a weighted sum. Translational distance is the Euclidean distance, and rotational distance is the angular difference between the rotation quaternions of transformation1 and transformation2.

    distance = dist(transformation1,transformation2,weights) specifies the weights weights for the translational and rotational distances for calculating the weighted sum of two homogeneous transformations.

    distance = dist(rotation1,rotation2) returns the distance distance between the poses represented by transformation rotation1 and transformation rotation2.

    For the homogeneous transformation objects se2, and se3, the dist function calculates translational and rotational distance independently and combines them in a weighted sum. Translational distance is the Euclidean distance, and rotational distance is the angular difference between the rotation quaternions of rotation1 and rotation2.

    For rotation objects so2, and so3, the dist function calculates the rotational distance as the angular difference between the rotation quaternions of rotation1 and rotation2.

    Input Arguments

    collapse all

    First transformation, specified as a scalar se2 object, a scalar se3 object, or as an N-element array of transformation objects, where N is the total number of transformations. If you specify transformation1 as an array, each element must be of the same type.

    Either transformation1 or transformation2 must be a scalar transformation object of the same type. For example, if transformation1 is an array of se2 objects, transformation2 must be a scalar se2 object.

    Last transformation, specified as a scalar se2 object, a scalar se3 object, or as an N-element array of transformation objects, where N is the total number of transformations. If you specify transformation2 as an array, each element must be of the same type.

    Either transformation1 or transformation2 must be a scalar transformation object of the same type. For example, if transformation1 is an array of se2 objects, transformation2 must be a scalar se2 object.

    First rotation, specified as a scalar so2 object, a scalar so3 object, or as an N-element array of rotation objects, where N is the total number of rotations. If you specify rotation1 as an array, each element must be of the same type.

    Either rotation1 or rotation2 must be a scalar rotation object of the same type. For example, if rotation1 is an array of so2 objects, rotation2 must be a scalar so2 object.

    Last rotation, specified as a scalar so2 object, a scalar so3 object, or as an N-element array of rotation objects, where N is the total number of rotations. If you specify rotation2 as an array, each element must be of the same type.

    Either rotation1 or rotation2 must be a scalar rotation object of the same type. For example, if rotation1 is an array of se2 objects, rotation2 must be a scalar se2 object.

    Weights of the translation and rotation in the distance sum, specified as a two-element row vector in the form [WeightXYZ WeightQ]. WeightXYZ is the translational weight and WeightQ is the rotational weight. Both weights must be nonnegative numeric values.

    Data Types: single | double

    Output Arguments

    collapse all

    Distance between transformations, returned as a nonnegative numeric scalar. The distance calculate changes depending on the transformation object type of transformation1 and transformation2 or rotation1 and rotation2:

    • se2 and se3 — The dist function calculates translational and rotational distance independently and combines them in a weighted sum specified by the weights argument. The translational distance is the Euclidean distance between transformation1 and transformation2. The rotational distance is the angular difference between the rotations of transformation1 and transformation2.

    • so2 and so3 — The dist function calculates the rotational distance as the angular difference between the rotations of rotation1 and rotation2.

    To calculate the rotational distance, the dist function converts the rotation matrix of transformation1 and transformation2 or rotation1 and rotation2 into quaternion objects and uses the quaternion dist function to calculate the angular distance.

    Version History

    Introduced in R2022b

    See Also

    Functions

    Objects