Add a light object to a figure using a simple interface.
When called with no arguments, a light object is added to the current plot
and is placed slightly above and to the right of the camera’s current
position: this is equivalent to camlight right
. The commands
camlight left
and camlight headlight
behave similarly with
the placement being either left of the camera position or centered on the
camera position.
For more control, the light position can be specified by an azimuthal rotation az and an elevation angle el, both in degrees, relative to the current properties of the camera.
The optional string style specifies whether the light is a local point
source ("local"
, the default) or placed at infinite distance
("infinite"
).
If the first argument hl is a handle to a light object, then act on this light object rather than creating a new object.
The optional return value h is a graphics handle to the light object. This can be used to move or further change properties of the light object.
Examples:
Add a light object to a plot
sphere (36); camlight
Position the light source exactly
camlight (45, 30);
Here the light is first pitched upwards from the camera position by 30 degrees. It is then yawed by 45 degrees to the right. Both rotations are centered around the camera target.
Return a handle to further manipulate the light object
clf sphere (36); hl = camlight ("left"); set (hl, "color", "r");
See also: light.
The following code
## Adding lights to a scene sphere (64); camlight ## Add a second light camlight left title ({"camlight()", "lights are left and right"});
Produces the following figure
Figure 1 |
---|
The following code
sphere (48); title ({"camlight()", "light in fixed position ignores camera change"}); axis equal; shading flat; view (30, 30); camlight for a = 30:2:390 view (a, 30); drawnow (); pause (0.01); endfor
Produces the following figure
Figure 1 |
---|
The following code
sphere (48); title ({"camlight()", "update light position with camera change"}); axis equal; shading flat view (30, 30); hl = camlight (); # keep a handle to the light for a = 30:2:390 view (a, 30); camlight (hl, "right"); # update light position drawnow (); pause (0.01); endfor
Produces the following figure
Figure 1 |
---|
Package: octave