# Documentation

### This is machine translation

Translated by
Mouseover text to see original. Click the button below to return to the English verison of the page.

# `Position`, `PositionX`, `PositionY`, `PositionZ`

Positions of cameras, lights, and text objects

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

## Value Summary

 `Position` Library wrapper for “[`PositionX`, `PositionY`]” (2D), “[`PositionX`, `PositionY`, `PositionZ`]” (3D) List of 2 or 3 expressions, depending on the dimension `PositionX`, `PositionY`, `PositionZ` Mandatory MuPAD® expression

## Graphics Primitives

ObjectsDefault Values
`plot::Camera`, `plot::DistantLight`, `plot::PointLight`, `plot::SpotLight`, `plot::Text2d`, `plot::Text3d`
`plot::Point2d`

`Position`: [`0`, `0`]

`PositionX`, `PositionY`: `0`

`plot::Plane`, `plot::Point3d`, `plot::Reflect3d`

`Position`: [`0`, `0`, `0`]

`PositionX`, `PositionY`, `PositionZ`: `0`

## Description

`Position` determines the positions of cameras, lights, and text objects.

`PositionX` etc. refer to the single coordinate values of the position.

The attribute `Position` refers to the location of a camera taking pictures of a 3D scene. Its a value is a list or vector of coordinates.

Also the position of light sources illuminating the 3D scene is set by `Position`.

Further, `Position` determines the coordinates where text objects are to be placed.

These attributes can be animated. Animating a camera position one can realize a flight through a 3D scene.

By default, the position of lights is given in model coordinates that have nothing to do with the camera that is used to view the scene.

The attribute `CameraCoordinates` also allows to position a light relative to the camera. In particular, the light moves automatically, when the camera is moved.

## Examples

### Example 1

We define a 3D scene consisting of a function, a distant light, and a camera. The light shines from the direction of the camera:

```f := plot::Function3d(sin(x^2 - y^2), x = -2..2, y = -2..2, Color = RGB::White): light := plot::DistantLight([3, 4, 5], [0, 0, 0], 0.75, Color = RGB::Yellow): camera := plot::Camera([3, 4, 5], [0, 0, 0], 0.25*PI): plot(f, light, camera)```

We animate the camera position but keep the light position fixed:

```camera::Position := [3*sqrt(2)*cos(a + PI/4), 4*sqrt(2)*sin(a + PI/4), 5*(0.7 + 0.3*cos(2*a))]: camera::ParameterName := a: camera::ParameterRange := 0..2*PI: plot(f, light, camera)```

Using the same objects, we fix the camera and animate the light position:

```camera::Position := [3, 4, 5]: camera::Frames := 1: light::Position := [3*sqrt(2)*cos(a + PI/4), 4*sqrt(2)*sin(a + PI/4), 5]: light::ParameterName := a: light::ParameterRange := 0..2*PI: plot(f, light, camera)```

`delete f, light, camera:`