[x,y,z] = sphere(20);
% light is on -Y axis, thus at the
rotate(hs,[0 0 1],30)
% rotate sphere to the right from 30°
It looks like the light has moved. This is due to a bug in rotate.m function. The "VertexNormals" property of the surf object is not updated as "xdata", "ydata" and "zdata" properties are.
This is fixed in the submitted version of rotate.m.
Luc Masset (2022). Rotate.m function fixed (https://www.mathworks.com/matlabcentral/fileexchange/35210-rotate-m-function-fixed), MATLAB Central File Exchange. Retrieved .
MATLAB Release Compatibility
Platform CompatibilityWindows macOS Linux
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!