Tag Info

Hot answers tagged

15

Note that ListContourPlot3D takes the coordinates to be the position indices by default. If you want to keep the coordinates used in generating the data, then you have to include it. data = Flatten[ Table[{x, y, z, x^2 + y^2 + z^2 + RandomReal[0.1]}, {x, -2, 2, 0.2}, {y, -2, 2, 0.2}, {z, -2, 2, 0.2}], 2]; plot = ListContourPlot3D[data, Contours ...


14

Here's a possible approach. First use TetGen to tetrahedralize the data: Needs["TetGenLink`"] {pts, tetrahedra} = TetGenDelaunay[data3D]; Next define a function to compute the radius of the circumsphere of a tetrahedron (formula from Wikipedia) csr[{aa_, bb_, cc_, dd_}] := With[{a = aa - dd, b = bb - dd, c = cc - dd}, Norm[a.a Cross[b, c] + b.b ...


12

Here is a more general approach. It is based on the 2D method from here. It assumes the polyhedron is not self-intersecting but imposes no requirement of convexity or even connectedness, other than that it be closed and bounded. Strictly speaking, I think this will work for an unbounded polyhedron provided it contains no vertical ray. For ease of exposition ...


10

In Version 10, this can be done elegantly in one line: SeedRandom[400] pts = RandomReal[5, {400, 3}]; Then: surftri = RegionBoundary @ TriangulateMesh @ DelaunayMesh @ pts We can look inside to see that only the surface triangulation remains: HighlightMesh[surftri, {Style[0, Directive[PointSize[0.015], Blue]], Style[1, Thin, Black], Style[2, ...


10

As pointed out in the comments, there's really no mathematical definition of a concave hull. Of course, just because there's no mathematical definition does not preclude coming up with something that sort of works. I can think of two ways to do this: Easy Way, Not General Your data roughly has axial symmetry parallel to the x-axis. Moreover, all of your ...


9

Here is a fast method that will "often" work. Roughly, it requires that the convex polygon have no sharp angles between faces. Preprocessing goes as follows. Create triangles from the polygons. So a 5-gon with vertices {a,b,c,d,e} would become the set of triangles {{a,b,c},{a,c,d},{a,d,e}}. For each vertex we average it's star (set of points connected by ...


7

Using Simon's answer (all credit to him): Needs["TetGenLink`"] file = "https://dl.dropboxusercontent.com/u/68983831/curved_pipe02.txt"; dat = Import[file, "Table"]; {pts, tetrahedra} = TetGenDelaunay[dat]; csr[{aa_, bb_, cc_, dd_}] := With[{a = aa - dd, b = bb - dd, c = cc - dd}, Norm[a.a Cross[b, c] + b.b Cross[c, a] + c.c Cross[a, b]]/(2 ...


6

The procedure I suggested for your other "concave hull" question seems to work reasonably well here, simultaneously isolating the clusters and creating the surfaces. Needs["TetGenLink`"]; {pts,tetrahedra}=TetGenDelaunay[data3D]; csr[{aa_,bb_,cc_,dd_}]:=With[{a=aa-dd,b=bb-dd,c=cc-dd}, Norm[a.a Cross[b,c]+b.b Cross[c,a]+c.c Cross[a,b]]/(2Norm[a.Cross[b,c]])]; ...


6

As I said before, there really isn't such a thing as a concave hull. What you want to do is plot your clusters here. The first problem involves a machine vision problem known as 3D segmentation. Mathematica doesn't have any tools out of the box to do this, as far as I know. One way is to guess how many "clusters" are in your data, although that's hard to ...


6

In Version 10 we have BoundaryDiscretizeGraphics and RegionMember to the rescue. So here we go: Reproducing the graphics: data = Flatten[Table[{x, y, z, x^2 + y^2 + z^2 + RandomReal[0.1]}, {x, -2, 2, 0.2}, {y, -2, 2, 0.2}, {z, -2, 2, 0.2}], 2]; (* Thanks to Taliesin Beynon for the tip *) plot = ListContourPlot3D[data, Contours -> {1}, Mesh -> ...


2

You can use TetGen and just make a z axis which is set to 0 (or any other constant). The issue with DelaunayTriangulation (if you want to generate a mesh from a list of points) is that it returns an adjacency list of the edges, which is very hard to turn into the polygons. This thread describes the issue with it. Adding a z dimention of 0 is simply: ...


1

If I understand you correctly, you would like to generate a mesh from a Cuboid. The meaning of the string is documented in V10 on the TetGenTetrahedralize ref page (also here in the details section.) The string option a1 tells TetGen to generate a mesh with has tetrahedra that are no larger than a volume of 1. (Unfortunatly there is a bug in TetGen 1.4.3 ...


1

Another approach is to use Imtek's package. These deal with both 2 and 3D with interfaces to Shewchuck's triangle and Tetgen respectively. Imtek can be had from the University of Freiburg. Documentation is extensive.



Only top voted, non community-wiki answers of a minimum length are eligible