Main Content

transformDirection

R2026b

Class: simscape.multibody.Transformation
Namespace: simscape.multibody

Apply rotation to 3-D column vectors

Since R2022a

Description

xv = transformDirection(t,v) applies only the rotational part of a transformation to a set of 3-D column vectors that represent directions. The translational part of the transformation does not affect the vectors because directions have no position.

Use this method to re-express direction vectors such as forces, velocities, or axis orientations from one frame to another. To transform position vectors that are affected by both rotation and translation, use transformPoint instead.

If the t argument is the transformation from follower frame to base frame, and the ith column of the v argument is a direction resolved in the follower frame, then the ith column of the xv argument is the same direction resolved in the base frame.

example

Input Arguments

expand all

Transformation, specified as a simscape.multibody.Transformation object.

Directions, specified as either 3-D column vectors or a simscape.Value object that represents 3-D column vectors with arbitrary units. Each vector represents a direction.

Output Arguments

expand all

Transformed directions, returned as either 3-D column vectors or a simscape.Value object that represents 3-D column vectors with arbitrary units. Each vector represents a direction. This argument and the vectors specified for the v argument always have the same format.

Attributes

Accesspublic

To learn about attributes of methods, see Method Attributes.

Examples

expand all

This example shows how to use transformDirection to re-express a direction vector from one frame to another.

Create a transformation that rotates 90 degrees about the z-axis and translates 5 meters along the x-axis.

t = simscape.multibody.Transformation([0.7071 0 0 0.7071], simscape.Value([5; 0; 0],"m"))
t =
  Transformation:

       Rotation: [0.7071 0 0 0.7071]
    Translation: [5 0 0] (m)

Transform a unit direction vector along the x-axis. The method applies only the rotation, so the [1; 0; 0] direction rotates 90 degrees about z to become [0; 1; 0]. The translation has no effect on directions.

xv = transformDirection(t, [1; 0; 0])
xv = 3×1 double
    0.0000
    1.0000
         0

Compare with transformPoint applied to the same vector, expressed as a simscape.Value object. The point transformation applies both rotation and translation, yielding a different result.

xp = transformPoint(t, simscape.Value([1; 0; 0],"m"))
xp =
    5.0000
    1.0000
         0

    (m)

Version History

Introduced in R2022a