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.

Imagine I import some 3DS (i.e. 3D studio) file (http://reference.wolfram.com/mathematica/ref/format/3DS.html) or a 3DS MAX file. How could I place this model (say, the 747.3ds file in the Mathematica manual) in a scaled cloud of 3D points, then generate a list of points that are internal or external to this object? I would also settle for points being within a threshold distance of some feature in the mesh defining the object?

As per Yves Klett's request (and hat tip to him for how to pull out a polygon list with triangle subcomponents) - what is the most efficient way to determine the set of points inside a list of polygons? I could perform a ray/triangle intersection test, for example, but is there some faster way using built-in routines in Mathematica 9? Is there something like InsidePolygonQ, perhaps using Delaunay triangulation? It looks like 3DS file polygons are convex (is this always true?), so that should simplify things.

Running the import command:

Import["...\\test.3ds", "PolygonObjects"]

Yields a list of convex polygons of the form:

{Polygon[{{1.67293, 8.08139, 100.633}, {1.67267, 8.15993, 100.652}, {-0.0264846, 8.07622, 100.631}}], <<13099>>}

I would be very happy to have a function that would like me input one of these polyhedra and a test point, and determine if that test point is inside out outside the polyhedra.

share|improve this question
Import["ExampleData/747.3ds.gz", "PolygonObjects"] does return triangles (check And @@ (Length[#] == 3 & /@ test[[All, 1]]) ) –  Yves Klett Apr 18 '13 at 14:23
Import using "GraphicsComplex" maybe somewhat more efficient. –  Sjoerd C. de Vries Apr 18 '13 at 14:34
@YvesKlett Just what I needed. –  FrozenMan Apr 18 '13 at 15:03
Perhaps you want to re-formulate your question to reflect your goal (unless you plan to answer the geometry part yourself)? Anyway, Efficiently determining if 3D points are within a surface composed of polygons might be useful, too. –  Yves Klett Apr 18 '13 at 15:07
Efficiency will depend on whether you intend to do many such tests with the same object, or just a few. If many, then some time spent preprocessing can save considerable time later. See responses in link posted by @Yves Klett. –  Daniel Lichtblau Apr 19 '13 at 14:09

Your Answer


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

Browse other questions tagged or ask your own question.