Documentation

# `plot`::`Rotate3d`

Rotations of 3D 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::Rotate3d(`angle`, <`[cx, cy, cz], [dx, dy, dz]`>, `obj1`, <`obj2, …`>, <`a = amin .. amax`>, `options`)
```

## Description

```plot::Rotate3d(angle, [cx, cy, cz], [dx, dy, dz], object)``` rotates a 3D object by the given angle around the rotation axis defined by the point ```[cx, cy, cz]``` and the direction ```[dx, dy, dz]```.

The rotation is implemented following the “right hand rule”: Stretch the thumb of your right hand and bend the fingers. When the thumb points into the direction of the rotation axis, your finger tips indicate the direction of the rotation. Use negative angles to rotate in the opposite direction.

Rotate objects can rotate several graphical objects simultaneously. Plotting the rotate object renders all graphical objects inside.

Rotated objects have a tendency to overestimate their `ViewingBox`. See the help page of `ViewingBox`. In such cases, specify a suitable `ViewingBox` explicitly.

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

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

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

## Attributes

AttributePurposeDefault Value
`AffectViewingBox`influence of objects on the `ViewingBox` of a scene`TRUE`
`Angle`rotation angle`0`
`Axis`rotation axis[`0`, `0`, `1`]
`AxisX`x-component of rotation axis`0`
`AxisY`y-component of rotation axis`0`
`AxisZ`z-component of rotation axis`1`
`Center`center of objects, rotation center[`0`, `0`, `0`]
`CenterX`center of objects, rotation center, x-component`0`
`CenterY`center of objects, rotation center, y-component`0`
`CenterZ`center of objects, rotation center, z-component`0`
`Frames`the number of frames in an animation`50`
`Name`the name of a plot object (for browser and legend)
`ParameterEnd`end value of the animation parameter
`ParameterName`name of the animation parameter
`ParameterBegin`initial value of the animation parameter
`ParameterRange`range of the animation parameter
`TimeEnd`end time of the animation`10.0`
`TimeBegin`start time of the animation`0.0`
`TimeRange`the real time span of an animation`0.0` .. `10.0`

## Examples

### Example 1

3D boxes with arbitrary orientation can be generated via `plot::Rotate3d`. Use several animated rotation objects:

```b0 := plot::Box(-3..3, -2..2, -1..1): b1 := plot::Rotate3d(a, [0, 0, 0], [0, 0, 1], b0, a = 0..PI/2, TimeRange = 0..3): b2 := plot::Rotate3d(a, [0, 0, 0], [0, 1, 0], b1, a = 0..PI/2, TimeRange = 3..6): b3 := plot::Rotate3d(a, [0, 0, 0], [1, 0, 0], b2, a = 0..PI/2, TimeRange = 6..9): plot(b0, b3):``` `delete b0, b1, b2, b3`

## Parameters

 `angle` The rotation angle in radians: a numerical real value or an arithmetical expression of the animation parameter `a`. `angle` is equivalent to the attribute `Angle`. `cx`, `cy`, `cz` The components of the rotation center: numerical real values or arithmetical expressions of the animation parameter `a`. If no rotation center is specified, the center `[0, 0, 0]` is used. `cx`, `cy`, `cz` are equivalent to the attributes `Center`, `CenterX`, `CenterY`, `CenterZ`. `dx`, `dy`, `dz` The components of the direction of the rotations axis: numerical real values or arithmetical expressions of the animation parameter `a`. If no direction is specified, the direction `[0, 0, 1]` is used. `dx`, `dy`, `dz` are equivalent to the attributes `Axis`, `AxisX`, `AxisY`, `AxisZ`. `obj1, obj2, …` Arbitrary plot objects of the appropriate dimension `a` Animation parameter, specified as `a```` = amin..amax```, where `amin` is the initial parameter value, and `amax` is the final parameter value.

#### Mathematical Modeling with Symbolic Math Toolbox

Get examples and videos