Thread Subject: Import a 3D model into Matlab and rotate/translate it

Subject: Import a 3D model into Matlab and rotate/translate it

From: Alexander

Date: 9 Oct, 2008 15:08:01

Message: 1 of 4

Hi,

I would like to import a 3D model file (like from Maya, 3DSMax, or something else) into Matlab in order to access its coordinates and the rotation angles.

Can you tell me how this is possible?
My aim is actually to animate the rotation of a fairly simple 3D model (using either drawnow or movie for animation). Will Matlab be able to handle this on a relatively up-to-date machine?

Bye,

Alexander

Subject: Import a 3D model into Matlab and rotate/translate it

From: Rune Allnor

Date: 9 Oct, 2008 16:01:52

Message: 2 of 4

On 9 Okt, 17:08, "Alexander " <alexander.erl...@gmail.com> wrote:
> Hi,
>
> I would like to import a 3D model file (like from Maya, 3DSMax, or something else) into Matlab in order to access its coordinates and the rotation angles.
>
> Can you tell me how this is possible?

In principle this is easy: Just get a description
of whatever file format you import from, and read
the data into the data structures internal to matlab.

In practice there are two problems: Obtaining the
file format descriptions and selecting what data
structures to use internal to matlab.

> My aim is actually to animate the rotation of a fairly simple 3D model (using either drawnow or movie for animation). Will Matlab be able to handle this on a relatively up-to-date machine?

Probably. Just be aware that 3D graphics is one
of the more demanding computational tasks around,
both what memory and algorithms are concerned, and
that matlab is notoriously inefficient what memory
and algorithms are concerned.

Rune

Subject: Import a 3D model into Matlab and rotate/translate it

From: Alexander

Date: 10 Oct, 2008 21:56:03

Message: 3 of 4

Thank you Rune,


> In practice there are two problems: Obtaining the
> file format descriptions and selecting what data
> structures to use internal to matlab.

yeah, I've seen that there is a file converter from CAD to Matlab, but I understand that there is no simple, Mathworks-predefined way. So I guess I'll have to change my plans a little.

Actually, what my goal is, is to build a simulation of a spinning top. For the beginning, some simple, symmetric looking object would suffice. I need access to its Euler angles as I receive them from numerically solving the differential equations. If all of that was given, I could simply update the three Euler angles frame by frame using drawnow or movie.


> Probably. Just be aware that 3D graphics is one
> of the more demanding computational tasks around,
> both what memory and algorithms are concerned, and
> that matlab is notoriously inefficient what memory
> and algorithms are concerned.

Actually, if sometime in the distant future I will realize doing the 3D grapics stuff in Matlab is too slow, is there an easy way to use a different renderer, like openGL? I mean, can I operate and update things from Matlab just like I described it, but address openGL directly?

Subject: Import a 3D model into Matlab and rotate/translate it

From: Rune Allnor

Date: 10 Oct, 2008 22:12:32

Message: 4 of 4

On 10 Okt, 23:56, "Alexander " <alexander.erl...@gmail.com> wrote:
> Thank you Rune,
>
> > In practice there are two problems: Obtaining the
> > file format descriptions and selecting what data
> > structures to use internal to matlab.
>
> yeah, I've seen that there is a file converter from CAD to Matlab, but I understand that there is no simple, Mathworks-predefined way. So I guess I'll have to change my plans a little.

Not necessarily. It is perfectly possible to write
your own routine to read the files if you can get
the file format spec.

> > Probably. Just be aware that 3D graphics is one
> > of the more demanding computational tasks around,
> > both what memory and algorithms are concerned, and
> > that matlab is notoriously inefficient what memory
> > and algorithms are concerned.
>
> Actually, if sometime in the distant future I will realize doing the 3D grapics stuff in Matlab is too slow, is there an easy way to use a different renderer, like openGL? I mean, can I operate and update things from Matlab just like I described it, but address openGL directly?

'Easy' and 'fast 3d graphics' are contradictions in terms.
You can configuure matlab to use the openGL renderer,
but the bottleneck is not necessarily to render the graphics,
but several factors distributed more or less evenly throughout
everything, from data formats (matlab uses matrices of double-
precision floating points by default) to memory access (you have
to pay very carful attention to how you store stuff or you might
get cache misses on every other data access).

Rune

Tags for this Thread

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

rssFeed for this Thread
 

MATLAB Central Terms of Use

NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content. Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available via MATLAB Central. Read the complete Terms prior to use.

Contact us at files@mathworks.com