# 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.

# `FocalPoint`, `FocalPointX`, `FocalPointY`, `FocalPointZ`

Focal point of a camera

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

 `FocalPoint` Library wrapper for “[`FocalPointX`, `FocalPointY`, `FocalPointZ`]” (3D) List of 2 or 3 expressions, depending on the dimension `FocalPointX`, `FocalPointY`, `FocalPointZ` Optional MuPAD® expression

## Graphics Primitives

ObjectsDefault Values
`plot::Camera`

## Description

The attribute `FocalPoint` refers to the point a camera taking pictures of a 3D scene is aimed at. Its value is a list or vector of coordinates (numerical values or symbolic expressions of an animation parameter).

`FocalPointX` etc. refer to the single coordinates `x` etc.

The optical axis of the camera is given by the vector from the camera `Position` to its `FocalPoint`.

When creating a camera by

```camera := plot::Camera(camera_position, focal_point, opening_angle)```,

the focal point is the second argument. Internally, this point is stored as the attribute `FocalPoint` and can be accessed and changed as `camera::FocalPoint`.

The focal point attributes can be animated.

Of course, the focal point should be set such that the camera points into the direction of the objects that are to be rendered. Typically, for a camera positioned outside the graphical scene, a good focal point is the center of the scene.

## Examples

### Example 1

We define a scene consisting of 4 geometric objects:

```b := plot::Box(4..5, -1..1, -1..1, Filled = FALSE, LineColor = RGB::Red): c1 := plot::Cone(1, [0, 4, 0], [0, 4, 1], Color = RGB::Green): s := plot::Sphere(1, [-4, 0, 0], Color = RGB::Blue): c2 := plot::Cone(1, [0, -4, 1], [0, -4, 0], Color = RGB::Orange):```

We use a small black object to mark the point (0, 0, 0.5), where we wish to place an animated camera:

```cameraposition := plot::Group3d( plot::Box(-0.1..0.1, -0.3..0.3, 0.3..0.7, Color = RGB::Black), plot::Cone(0.1, [0, 0, 0.5], 0.3, [0.5, 0, 0.5], Color = RGB::DarkGrey)): plot(b, c1, s, c2, cameraposition)```

When defining the camera, the second argument is the `FocalPoint`. In this case, it is animated: The camera is to turn around the z-axis.

```camera := plot::Camera([0, 0, 0.5], [4*cos(a), 4*sin(a), 0], PI/4, a = 0..2*PI): camera::FocalPoint```

We insert the animated camera:

`plot(b, c1, s, c2, camera)`

`delete b, c1, s, c2, cameraposition, camera:`

### Example 2

We define a function and a camera with an animated focal point:

```f := plot::Function3d(sin(x^2-y^2), x = -2..2, y = -2..2, Submesh = [2, 2]): camera := plot::Camera([3, 3, 3], [sin(a), cos(a), 0], PI/6, a = 0..2*PI): plot(f, camera)```

`delete f, camera:`