Code covered by the BSD License  

Highlights from
Rubik Cube Game

from Rubik Cube Game by Sergii Iglin
Task: to solve Rubik's Cube.

PlotCube(hAxes,Cube)
function Res = PlotCube(hAxes,Cube)
% plot the cube Cube in axes hAxes
axes(hAxes); % current axes for draw
cla
hold on
for k=1:27,
  CurrNodes = Cube.Nodes(:,:,k);
  CurrColor = Cube.Color(:,:,k);
  patch('Vertices',CurrNodes,'Faces',Cube.Order,...
    'FaceVertexCData',CurrColor,'FaceColor','flat',...
    'ButtonDownFcn','Cube=RotateWithMouse(hAxes,Cube);');
end
hold off
return

Contact us at files@mathworks.com