Tag Info

New answers tagged

1

This might be a bit naive but if you are approximating a cylinder, why wouldn't you simply do the following? pts = Import["https://dl.dropboxusercontent.com/u/68983831/npts.txt", "Table"]; cpts = Import["https://dl.dropboxusercontent.com/u/68983831/cpts.txt", "Table"]; polys = Import["https://dl.dropboxusercontent.com/u/68983831/npolys.txt", "Table"]; fpts ...


1

Here is a workaround for this I've been using: p2 = Graphics3D@First@ParametricPlot3D[{Cos[t], Sin[u], Sin[t]}, {u, 0, 2 Pi}, {t, 0, 2 Pi}] Now we discretize: DiscretizeGraphics[Normal[p2 /. (Lighting -> _) :> Lighting -> Automatic]]


3

Here is another way that uses the Graphics object directly: gr = ParametricPlot3D[{Cos[u], Sin[u] + Cos[v], Sin[v]}, {u, 0, 2 Pi}, {v, -Pi, Pi}] We discretize the graphics using DiscretizeGraphics mr = DiscretizeGraphics[Normal[gr /. (Lighting -> _) :> Lighting -> Automatic]] We compute the convex hull hull = ...


2

In Version 10, we can compute the convex hull using ConvexHullMesh p = {{2, 1, 6}, {4, 3, 0}, {5, 2, 5}, {3, 5, 4}} chull = ConvexHullMesh[p] Which we can style using HighlightMesh Show[HighlightMesh[chull, Labeled[1, "Index"]], Graphics3D[{Red, Sphere[p, 0.1]}]]


2

In the current release, you can try the following: pf = {Cos[u], Sin[u] + Cos[v], Sin[v]}; gr = ParametricPlot3D[pf, {u, 0, 2 Pi}, {v, -Pi, Pi}]; mr = DiscretizeGraphics[gr // Normal] Disregard the message about Lighting not supported, DiscretizeGraphics[gr //Normal] will remove the duplicated points Now this will work: ...


4

Here is a workaround: r1 = RegionDifference[Rectangle[{0, 0}, {10, 10}], Rectangle[{4, 4}, {8, 8}]]; r2 = TransformedRegion[r1, RotationTransform[45 \[Degree], {5, 5}]]; mr = DiscretizeRegion[r2] And then: RegionPlot[mr]


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 ...


6

This is at least one bug, possibly more. Let me explain: If we go one step further and use Needs["TetGenLink`"] tethull = TetGenConvexHull[pts]; bmr = BoundaryMeshRegion[tethull[[1]], {Polygon[tethull[[2]]]}] BoundaryMeshRegion::binsect: "The boundary curves self-intersect or cross each other in ...


2

In Version 10, once the points have been obtained as per user21's approach, we can tetrahedralize them directly using DelaunayMesh pf = {Cos[u], Sin[u] + Cos[v], Sin[v]}; pp = ParametricPlot3D[pf, {u, 0, 2 Pi}, {v, -Pi, Pi}] data = Reap[ParametricPlot3D[Sow[pf], {u, 0, 2 Pi}, {v, -Pi, Pi}]][[2, 1]]; pts = Cases[data, {_?NumericQ, _?NumericQ, ...


1

In Version 10 there is such a function. Meet RegionMember. We take your Cylinder primitive as an example: cyl = Cylinder[] Let's create some points: pts = RandomReal[{-1.5, 1.5}, {100, 3}]; Now we create a RegionMemberFunction that can be used repeatedly on various points. mf = RegionMember[cyl] We apply mf to the set of points and give them ...


1

In Version 10, there is now the built-in ConvexHullMesh to do exactly this. pos = Position[DiskMatrix[{12, 10, 8}], 1]; To get the 3D convex hull: ConvexHullMesh[pos]


5

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

I think the problem is in the ordering of points in p2. if we plot p2 with the nodes we will find the following graphic: p2 = Polygon[{{-102.253, 21.8671}, {-102.253, 21.8682}, {-102.253, 21.8682}, {-102.253, 21.8682}, {-102.253, 21.8681}, {-102.252, 21.868}, {-102.252, 21.8678}, {-102.252, 21.8673}, {-102.253, 21.8672}, {-102.253, ...


9

In the end this is a bug and I filed that. Now, what is going on: If you extract the coords and polygons from the GraphicsComplex and try to set up a MeshRegion you get a warning: gc = First@ ParametricPlot3D[{Cos[t], Sin[u], Sin[t]}, {u, 0, 2 Pi}, {t, 0, 2 Pi}]; ply = Cases[(gc)[[2]], _Polygon, Infinity] MeshRegion[gc[[1]], ply] ...


5

Have try this following code. vertices1 = {{-1, -1, -1}, {-1, -1, 1}, {-1, 1, -1}, {-1, 1, 1}, {1, -1, -1}, {1, -1, 1}, {1, 1, -1}, {1, 1, 1}}; vertices2 = {{-(1/2), -(1/2), -(1/2)}, {5/6, -(7/6), 5/6}, {-(7/6), 5/6, 5/6}, {1/6, 1/6, 13/6}, {5/6, 5/6, -(7/6)}, {13/6, 1/6, 1/6}, {1/6, 13/6, 1/6}, {3/2, 3/2, 3/2}}; faces = {{5, 6, 8, 7}, {1, ...


8

We could do this with graph theory. Let's turn the polygon structure into a graph: g3 = Graph[UndirectedEdge @@@ Union[Sort /@ Flatten[polys /. {a_, b_, c_} :> {{a, b}, {b, c}, {c, a}}, 1]]] This creates a graph edge for each edge of each triangle, then filters it down to unique edges. For the 2D we need to first join the ends. Let's visually see ...


4

To find the area of these points, we first must convert to a projected coordinate system. Since your points lie in multiple state plane systems, we'll use UTM zone 11 to convert your latitude longitudes. Here are the points courtesy of new Wolfram Language functions... latlons = {{32.6123, -117.041}, {40.6973, -111.9}, {34.0276, -118.046}, {40.8231, ...


6

Here is the general answer for any shaped object of surface genus-0, though it can have holes as long as it's an outer boundary (maybe its more general and someone can correct me). I will first describe the general UV mapping. This is usually done for a surface with a pre-chosen boundary, you need to choose which points are part of the boundary and give ...



Top 50 recent answers are included