This functionality does not run in MATLAB.
plot::SpotLight([px, py, pz], [tx, ty, tz], angle, <intensity>, <a = amin .. amax>, options)
plot::SpotLight([px, py, pz], [tx, ty, tz], angle, intensity) generates a spot light at the position px, py, pz, aimed at the point tx, ty, tz. The opening angle of the light cone is given by angle.
Each 3D scene is illuminated by several light sources that are set automatically and cannot be controlled by the user. Cf. the help page of Lighting.
If at least one user defined light source is inserted into the scene (e.g., by simply passing the light objects as input parameters to the plot command), the automatic lights are switched off and the user defined lights are used to illuminate the scene.
plot::SpotLight([px, py, pz], [tx, ty, tz], angle) creates a spot light source at the point [px, py, pz] emitting a light cone towards the point [tx, ty, tz]. In contrast to real life, the light flux of a spot light does not decrease with the distance to the light source.
By default, white light is created. Other colours can be chosen by the attribute LightColor.
When using the attribute CameraCoordinates = TRUE, the light source is fixed to the camera. It moves automatically, when the camera is moved.
Directed light such as plot::SpotLight create shading effects that add depth to the picture.
Usually, you will use spot lights to highlight special details of the scene. For the illumination of the entire scene you will usually need additional undirected ambient light of type plot::AmbientLight, too.
Note that all light sources create a homogeneous lighing effect for a 3D triangle. Thus, realistic shading effects can only be achieved for surfaces with a sufficiently fine triangulation. For function graphs (plot::Function3d) and parametrized surfaces (plot::Surface), a fine triangulation is created by sufficiently high values of XMesh, YMesh or UMesh, VMesh, respectively.
|CameraCoordinates||position of light sources relative to the camera?||FALSE|
|Frames||the number of frames in an animation||50|
|LightColor||the color of light||RGB::White|
|LightIntensity||intensity of light||1.0|
|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|
|Position||positions of cameras, lights, and text objects|
|PositionX||x-positions of cameras, lights, and text objects|
|PositionY||y-positions of cameras, lights, and text objects|
|PositionZ||z-positions of cameras, lights, and text objects|
|SpotAngle||opening angle of the light cone of a spot light|
|Target||the target point of a light|
|TargetX||the target point of a light, x component|
|TargetY||the target point of a light, y component|
|TargetZ||the target point of a light, z component|
|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|
We create three white surfaces and illuminate them by two animated white spot lights and some ambient light. The spot lights are indicated by little cones:
s1 := plot::Surface([1, y, z], y = 0..1, z = 0..1): s2 := plot::Surface([x, 1, z], x = 0..1, z = 0..1, Submesh = [2, 2]): s3 := plot::Surface([x, y, 0], x = 0..1, y = 0..1, Submesh = [2, 2]): ambientlight:= plot::AmbientLight(0.4): spotlight1 := plot::SpotLight([1/3, a, 1/3], [1/3, 1, 1/3], PI/5, a = 0..0.8): c1 := plot::Cone(0, [1/3, a, 1/3], 0.2*tan(PI/10), [1/3, a + 0.2, 1/3], a = 0..0.8, Color = RGB::Orange.[0.5]): spotlight2 := plot::SpotLight([2/3, a, 2/3], [2/3, a, 0], PI/4, a = 0.15..0.95): c2 := plot::Cone(0, [2/3, a, 2/3], 0.2*tan(PI/8), [2/3, a, 2/3 - 0.2], a = 0.15..0.95, Color = RGB::Orange.[0.5]): plot(s1, s2, s3, FillColor = RGB::White, FillColorType = Flat, ambientlight, c1, spotlight1, c2, spotlight2, Axes = Frame):
delete s1, s2, s3, c1, c2, ambientlight, spotlight1, spotlight2:
px, py, pz
The coordinates of the position: numerical values or arithmetical expressions of the animation parameter a.
tx, ty, tz
The coordinates of the point the light is shining to: numerical values or arithmetical expressions of the animation parameter a.
The opening angle of the light cone in radians: a numerical value between 0 and π or an arithmetical expression of the animation parameter a.
angle is equivalent to the attribute SpotAngle.
The intensity of the light: a numerical value between 0 and 1 or an arithmetical expression of the animation parameter a.
intensity is equivalent to the attribute LightIntensity.
Animation parameter, specified as a = amin..amax, where amin is the initial parameter value, and amax is the final parameter value.