pyvista.Light.cone_angle

Contents

pyvista.Light.cone_angle#

property Light.cone_angle[source]#

Return or set the cone angle of a positional light.

The angle is in degrees and is measured between the axis of the cone and an extremal ray of the cone. A value smaller than 90 has spot lighting effects, anything equal to and above 90 is just a positional light, i.e. a spherical point source.

Regarding the angular distribution of the light, the cone angle merely truncates the beam, the shape of which is defined by the exponent. If the cone angle is at least 90 degrees then there is no angular dependence.

If the light’s cone angle is increased to 90 degrees or above, its actor (if previously shown) is automatically hidden.

Examples

Plot three planes lit by three spotlights with varying cone angles. Use a large exponent to cause a visible angular variation of the intensity of the beams.

>>> import pyvista as pv
>>> plotter = pv.Plotter(lighting='none')
>>> for offset, angle in zip([0, 1.5, 3], [70, 30, 20]):
...     _ = plotter.add_mesh(
...         pv.Plane((offset, 0, 0)), color='white'
...     )
...     light = pv.Light(
...         position=(offset, 0, 1), focal_point=(offset, 0, 0)
...     )
...     light.exponent = 15
...     light.positional = True
...     light.cone_angle = angle
...     plotter.add_light(light)
...
>>> plotter.view_xy()
>>> plotter.show()
../../../_images/pyvista-Light-cone_angle-1_00_00.png