Documentation

# plot::Transform2d

Affine linear transformation of 2D objects

MuPAD® notebooks will be removed in a future release. Use MATLAB® live scripts instead.

MATLAB live scripts support most MuPAD functionality, though there are some differences. For more information, see Convert MuPAD Notebooks to MATLAB Live Scripts.

## Syntax

plot::Transform2d(<b2d>, A2d, obj1, <obj2,...>, <a = amin .. amax>, options)

## Description

plot::Transform2d(b, A, objects) with a vector b and a matrix A applies the affine linear transformation $x\to Ax+b$ to 2D objects.

The transformation matrix A can be specified by a list of lists, with the sublists representing the rows.

[[A1, 1, A1, 2, …], [A2, 1, A2, 2, …], …]

A plain list [A1, 1, A1, 2, A2, 1, A2, 2] represents the matrix row by row.

Transform objects can transform several graphical objects simultaneously. Plotting the transform object renders all graphical objects inside.

Transformed objects have a tendency to overestimate their ViewingBox. In such cases, specify a suitable ViewingBox explicitly.

Transformation objects can be used inside transformation objects. If they are animated, the animations run simultaneously.

Animated transform objects are rather “cheap” concerning computing and storing costs. For more complex graphical objects, it is more efficient to use an animated transform object than to redefine the object for each frame.

The function op allows to extract the graphical objects inside a transformation object.

## Attributes

AttributePurposeDefault Value
AffectViewingBoxinfluence of objects on the ViewingBox of a sceneTRUE
Framesthe number of frames in an animation50
Matrix2dtransformation matrices[1, 0, 0, 1]
Namethe name of a plot object (for browser and legend)
ParameterEndend value of the animation parameter
ParameterNamename of the animation parameter
ParameterBegininitial value of the animation parameter
ParameterRangerange of the animation parameter
Shiftshift vector[0, 0]
ShiftXshift vector0
ShiftYshift vector0
TimeEndend time of the animation10.0
TimeBeginstart time of the animation0.0
TimeRangethe real time span of an animation0.0 .. 10.0

## Examples

### Example 1

Visualize a linear transformation $x\to Ax$ without shift:

x1 := plot::Arrow2d([0, 0], [1/3, 1], Color = RGB::Red):
x2 := plot::Arrow2d([0, 0], [1, 1], Color = RGB::Green):
x3 := plot::Arrow2d([0, 0], [1, 1/3], Color = RGB::Blue):
A :=  matrix([[1, -2], [-2, 1]]):
plot(plot::Scene2d(x1, x2, x3),
plot::Scene2d(plot::Transform2d(A, x1, x2, x3)),
Scaling = Constrained, Layout = Horizontal):

delete x1, x2, x3, A:

## Parameters

 b2d The 2D shift vector: a list with 2 entries. Also vectors generated by matrix and arrays are accepted. The entries must be numerical values or arithmetical expressions of the animation paramater a. b2d is equivalent to the attribute Shift. A2d The 2D transformation matrix: a 2×2 matrix, a 2×2 array, a list of 2 lists, or a plain list with 4 entries. The entries must be numerical values or arithmetical expressions of the animation paramater a. A2d is equivalent to the attribute Matrix2d. obj1, obj2, … Plot objects a Animation parameter, specified as a = amin..amax, where amin is the initial parameter value, and amax is the final parameter value.