12.07.2015 Views

MATLAB Function Reference (Volume 2: Graphics)

MATLAB Function Reference (Volume 2: Graphics)

MATLAB Function Reference (Volume 2: Graphics)

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

lightPurpose2lightCreate a light objectSyntaxDescriptionlight('PropertyName',PropertyValue,...)handle = light(...)light creates a light object in the current axes. lights affect only patch andsurface object.light('PropertyName',PropertyValue,...) creates a light object using thespecified values for the named properties. <strong>MATLAB</strong> parents the light to thecurrent axes unless you specify another axes with the Parent property.handle = light(...) returns the handle of the light object created.RemarksExamplesYou cannot see a light object per se, but you can see the effects of the lightsource on patch and surface objects. You can also specify an axes-wide ambientlight color that illuminates these objects. However, ambient light is visible onlywhen at least one light object is present and visible in the axes.You can specify properties as property name/property value pairs, structurearrays, and cell arrays (see set and get for examples of how to specify thesedata types).See also the patch and surface AmbientStrength, DiffuseStrength,SpecularStrength, SpecularExponent, SpecularColorReflectance, andVertexNormals properties. Also see the lighting and material commands.Light the peaks surface plot with a light source located at infinity and orientedalong the direction defined by the vector [1 0 0], that is, along the x-axis.h = surf(peaks);set(h,’FaceLighting’,’phong’,'FaceColor',’interp’,...'AmbientStrength',0.5)light('Position’,[1 0 0],’Style’,’infinite’);ObjectHierarchy2-261

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!