lightangle

Creates or moves a light using azimuth and elevation angles.

Category: Graphics > Formatting and Annotation

Syntax

lightangle(az, el)

Creates a light at azimuth az and elevation el, in degrees.

lightangle(lightobj, az, el)

Moves an existing light.

h = lightangle(___)

Returns the light object.

Description

The angles are converted to a position vector and stored in the light's Position property. The light is placed relative to the axes, not to the camera, so rotating the plot afterwards does not move it. For a light that follows the camera, use camlight.

As with light, the surfaces need a lighting mode other than 'none' to react.

Input arguments

az, el
Azimuth and elevation of the light in degrees, measured in the same way as for view.
lightobj
Handle of a light created earlier.

Output arguments

h
Light object whose Position is the unit vector for the given angles.

Example

Light from azimuth 45, elevation 30

surf(peaks(30))
lighting gouraud
h = lightangle(45, 30);
h.Position
Output
ans = 1×3

    0.6124   -0.6124    0.5000

See also

light camlight lighting view material