This is machine translation

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

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

Target, TargetX, TargetY, TargetZ

Target point of a light

MuPAD® notebooks are not recommended. 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.

Value Summary

TargetLibrary wrapper for “[TargetX, TargetY, TargetZ]” (3D)List of 2 or 3 expressions, depending on the dimension
TargetX, TargetY, TargetZMandatoryMuPAD® expression

Graphics Primitives

ObjectsDefault Values
plot::DistantLight, plot::SpotLight 


The Target attribute refers to the point a spot light is aimed at. It also controls the direction of a distant light which is given by the vector Target - Position.

Target sets the position of the point lights of type plot::DistantLight and plot::SpotLight are aimed at. TargetX etc. refer to the single coordinates of this point.

The value of Target is a list or vector of coordinates. TargetX = x etc. refer to the single coordinates of this list.

These attributes can be animated.

By default, the positions and the targets of light objects are given in model coordinates that have nothing to do with the camera that is used to view the scene.

When using the attribute CameraCoordinates = TRUE, the light source is fixed to the camera. It moves automatically, when the camera is moved.


Example 1

When generating lights of type plot::DistantLight and plot::SpotLight, the second argument ist the Target. In the following expample, it is animated:

sunlight := plot::DistantLight([0, 0, 2], 
                               [cos(a), sin(a), 1],
                               a = 0..2*PI):
spotlight := plot::SpotLight([0, 0, 1], 
                             [cos(a), sin(a), 1/2], 
                             PI/5, a = 0..2*PI):
sunlight::Target, spotlight::Target

We illuminate a paraboloid with sunlight. Its direction is animated by the Target attribute:

f := plot::Function3d(x^2 + y^2, x = -1..1, y = -1..1):
plot(f, sunlight, CameraDirection = [-1, -2, 6])

We use the animated spot light:

plot(f, spotlight, CameraDirection = [-1, -2, 6])

delete sunlight, spotlight, f:

See Also

MuPAD Functions

Was this topic helpful?