From: Ahmed Hussain on
Dear Steve,

Can you help me knowing how to load and display a 3D model in DirectX file (.x file). I have two 3D models and I have to load and display them in MATLAB. The rotation and translation can be done using cameratoolbar.

Thanks,

Best Wishes,

Ahmed H.
CTH-Sweden

"Steven Lord" <slord(a)mathworks.com> wrote in message <hl15k9$rd2$1(a)fred.mathworks.com>...
>
> "Husam Aldahiyat" <numandina(a)gmail.com> wrote in message
> news:hl0o06$d6d$1(a)fred.mathworks.com...
> > "Ahmed Hussain" <ahmedhussain85(a)yahoo.com> wrote in message
> > <hkv6mq$88s$1(a)fred.mathworks.com>...
> >> I want to plot a 3D sphere in a figure which should be inside another 3D
> >> figure. It should be like that: If I 3D rotate the outer figure, the
> >> inner figure should also rotate likewise. But if I rotate in the inner
> >> figure it should have no effect on the inner figure. Is it possible?
> >>
> >> To understand this problem more easily, imagine I want to draw a football
> >> inside a cupboard. If I move the cupboard the ball will also move
> >> likewise. But if I move the ball, the position of cupboard will not
> >> change.
> >>
> >> Is it possible to do such a thing in matlab? If yes, please help!
> >>
> >> Ahmed H.
> >> CTH - Sweden
> >
> > You have two axes, let's say they're called axes1 and axes2. axes1
> > contains one plot, and its "child" is axes2.
> >
> > If you rotate axes1, what happens is you change the axes 'view' property
> > (vector containing two elements; azumith and elevation), so what you want
> > to do is that whenever the view property of the first axes changes, the
> > second axes' view property is changed as well. Right?
> >
> > You can do this using v = get(axes1,'view') and then set(axes2,'view',v).
> >
> > In order for the program to do this automatically, you can assign to the
> > first figure a buttondownfcn which keeps checking the new view valuesuntil
> > you stop rotating (i.e. release the mouse button).
>
> Another possibility is to use the ROTATE function. A slightly modified
> version of the example from the reference page:
>
> http://www.mathworks.com/access/helpdesk/help/techdoc/ref/rotate.html
>
> h = surf(peaks(20));
> zdir = [0 0 1];
> center = [10 10 0];
> for k = 1:90
> rotate(h, zdir, 1, center);
> drawnow
> end
>
> --
> Steve Lord
> slord(a)mathworks.com
> comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ
>
From: Steven Lord on

"Ahmed Hussain" <ahmedhussain85(a)yahoo.com> wrote in message
news:hn4un5$35l$1(a)fred.mathworks.com...
> Dear Steve,
>
> Can you help me knowing how to load and display a 3D model in DirectX file
> (.x file). I have two 3D models and I have to load and display them in
> MATLAB. The rotation and translation can be done using cameratoolbar.

No, I can't, as I have not worked directly with DirectX files.

--
Steve Lord
slord(a)mathworks.com
comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ