Tag Info

New answers tagged

0

This is morally like ListPlot3D[], but that does the wrong thing. To do the right thing, do the following: instantiatePoly[p_, ptlist_] := Map[ptlist[[#]] &, p] drawFunc[planar_, vals_] := Module[{triples = MapThread[Append, {planar, vals}]}, Graphics3D[ Map[instantiatePoly[#, triples] &, ...


3

My take on this, with some inspiration from shrx's great answer. I pick points randomly, but weighted by the image gradient to try to get more points on edges in the image. Then I use a Delaunay triangulation so that those edges are maintained in the mesh. Finally I colour it by taking the single pixel value at the centre of each triangle (rather than the ...


6

i = ExampleData[{"TestImage", "Mandrill"}]; id = ImageDimensions[i]; Create some keypoints and use them to make a triangular mesh: xy = ImageKeypoints[i, MaxFeatures -> 50]; m = VoronoiMesh[xy, {0, #} & /@ id]; mt = TriangulateMesh[#, MaxCellMeasure -> ∞, MeshQualityGoal -> "Minimal"] & /@ Map[MeshRegion[MeshCoordinates[m], #] ...


10

Here are a few additions to @RunnyKine suggestions. If you are ever in doubt about the quality of a mesh (an ElementMesh to be exact) you can query the mesh. Needs["NDSolve`FEM`"] region = ImplicitRegion[! (Norm[{x, y, z}] < 1), {{x, -5, 5}, {y, -5, 5}, {z, 0, 5}}]; mesh = ToElementMesh[region]; Min[mesh["Quality"]] 0.004439742441262357` So the ...


14

The mesh seems to be fine and you can see that it is by doing: region = ImplicitRegion[! (Norm[{x, y, z}] < 1), {{x, -5, 5}, {y, -5, 5}, {z, 0, 5}}]; m = DiscretizeRegion[region, {{-2, 2}, {-2, 2}, {0, 1}}] To view as wireframe you can do: Needs["NDSolve`FEM`"] mesh = ToElementMesh[m] // Quiet; Then: Show[mesh["Wireframe"]] If you want to ...


0

When you save it as PDF and open it later, Graphics content is no more the same. You may check it out with: ArrayPlot[1. - IdentityMatrix[4], ColorFunction -> GrayLevel, ColorFunctionScaling -> False, Mesh -> None] // FullForm Then you save the image output as PDF (copy should have the same effect) Reopen the PDF (or paste it), then examine ...


3

In Mathematica 10, you can use DelaunayMesh on a set of points. This returns a MeshRegion. You can use MeshCoordinates to return a list of coordinates of the points (should be the same as the initial set of points) and then MeshCells to return the triangles. See Interactive Computational Geometry for more details.


6

There are some new functions in Mathematica 10 that make this very easy: r = {{-6, 6}, {-6, 6}}; pts = RandomSample[Permutations[Range[-5, 5], {2}], 10]; Grid[{ {"The sites", "Delaunay trianguation", "Voronoi diagram"}, { Graphics[{Red, Point[pts]}, PlotRange -> r], Show[dm = DelaunayMesh[ pts], Graphics[{Red, Point[pts]}], PlotRange -> ...



Top 50 recent answers are included