Re: A Matlab question on Patch



"Shariful " <bluepearlb@xxxxxxxxx> wrote in message
<g4veqt$r55$1@xxxxxxxxxxxxxxxxxx>...
Hi, Thanks for your email. I am new to matlab GUI. Let's do
the easier one first. I have got 2 axes (Name: axesL and
axesR) where 2 real-head models get loaded. I have made 4
push-buttons (for each) to rotate the model. Would you
please write few line code (for a button) to rotate the
patch in some direction, please. Thanks

roberson@xxxxxxxxxxxxxxxxxx (Walter Roberson) wrote in
message <g4tgoj$srm$1@xxxxxxxxxxxxxxxxxxxxxxx>...
In article <g4sod9$8df$1@xxxxxxxxxxxxxxxxxx>,
Shariful <bluepearlb@xxxxxxxxx> wrote:

I am working on a Matlab GUI. I was able to load a patch (a
human brain) into one axes of my figure. Now I would like
to rotate the patch in various direction, change its
transparency, color etc.

Does the patch have to be rotated relative to other
objects that
are to be kept fixed in place, or is it okay if the entire
viewpoint changes (corresponding to changing the direction
you are looking at the scene)? Rotating the entire scene is
relatively easy, by changing the axes Camera* parameters;
rotating
the patch while keeping other things unchanged is more work.

For transparency and color, I suggest that you go into the
matlab
doc and ask it to search on
patch properties

--
amazon.com's top 8 books about "walter" are Kotzwinkle/
Gundy/ Colman's
"Walter the Farting Dog"



What is a real-head model? Are you talking about actual
matlab patches made using the patch command, or images made
using the image or imshow commands? It seems suspicious that
you would have a "patch of a human brain" or do you mean a
3-D model made out of patches?

But anyway, here is a function i wrote for a 3-D rotation
button, which is very similar to the built in 3-D rotation
button on the figure toolbar: (this is the callback of a
togglebutton that you push on/off to enable/disable
rotation.) It should be pretty obvious how to modify this
for your gui...


function GUIrotate3d(hObject,eventdata)


handles=guidata(gcf);

%do 3d rotation for active graph.

if get(hObject,'value')

%start rotate3d mode:

handles.rotater=rotate3d(handles.activegraph);
set(handles.rotater,'enable','on');

%ban all axes from rotating:
allaxes=findobj(gcf,'type','axes');

setAllowAxesRotate(handles.rotater,allaxes,false);

%allow active graph to rotate:

setAllowAxesRotate(handles.rotater,handles.activegraph,true);

else
%turn off 3d rotation:
if isa(handles.rotater,'graphics.rotate3d')
set(handles.rotater,'enable','off')
end

end

.


Loading