Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

How do I read in an obj file as a MeshRegion so I can e.g. compute its area?

If I just import the object and try Area[O] it tells me it is not a correctly specified region, even for e.g. the StanfordBunny.

Also, how do I turn Geometry3D into a MeshRegion? For example

Area[ExampleData[{"Geometry3D", "SpaceShuttle"}]]

does not work either.

It seems that geometry has more than one representation in different parts of Mathematica - bad.

share|improve this question

1 Answer 1

up vote 9 down vote accepted

Well, you have to first convert it to a MeshRegion. Let's take the space shuttle for example:

shuttle = ExampleData[{"Geometry3D", "SpaceShuttle"}]

Mathematica graphics

Now, we discretize it, since it's a Graphics3D object, we use DiscretizeGraphics:

ds = DiscretizeGraphics[shuttle]

Mathematica graphics

Now, we can find the Area easily:

Area[ds]

177.301907

Similarly for the horse:

horse = ExampleData[{"Geometry3D", "Horse"}]

Mathematica graphics

dh = DiscretizeGraphics[horse]

Mathematica graphics

We compute the surface area:

Area[dh]

0.0358690432

share|improve this answer
    
Does not always work. Area[DiscretizeGraphics[Import["somefile.obj"]]] still give a not correctly specified region error. –  Ralph Aug 18 at 10:51
    
Retried it and it did work. Apologies. I must have typed something wrong. –  Ralph Aug 19 at 7:44

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.