New answers tagged

1

From the documentation, PolygonDecomposition gives a Polygon consisting of a union of polygons with disjoint interiors, but boundaries may overlap. Technically, the polygon in question has a decomposition into interior-disjoint polygons, but it happens not to be treated that way (Mathematica's documentation seems to mean that adjacent pieces in a ...


6

Don't have the time to fully answer this yet, but here's a debug tool I developed previously. First off we can figure out how OBJ is exported getFormatExportData["OBJ"] {"FormatName" -> "OBJ", "DefaultElement" -> "Graphics3D", "DocumentedElements" -> None, "Function" -> ...


6

I think you betw data is a bit messed up. I show you how to work around that. We ignore betw and in stead ad a line connecting the str and mcr boundaries = {mcr, betz, st, air}; Needs["NDSolve`FEM`"] bms = Join[ ToBoundaryMesh /@ boundaries, {ToBoundaryMesh[ "Coordinates" -> {{0.447`, 0.868`}, {0.483`, 0.868`}}, &...


1

Still not sure why Show scales the meshes, but HighlightImage gives me exactly what I want! HighlightImage[pic, Graphics[GraphicsComplex[MeshCoordinates[#], {Thick, Red, MeshCells[#, 1]}]] & /@ allCluster]


6

One way can be by Generating a Periodic Voronoi Mesh. Adopting @ChipHarst's answer we can start by generating a periodic Voronoi Mesh. pts = RandomReal[{-1, 1}, {8, 2}]; pts2 = Flatten[Table[TranslationTransform[{2 i,2 j}][pts],{i,-1,1}, {j,-1,1}],2]; vor = VoronoiMesh[pts2, 2 {{-1, 1}, {-1, 1}}]; vcells = Catenate[NearestMeshCells[{vor, 2}, #] & /@ pts]...


2

I get the same meshed result as @zongxian with and without @J.M.'s recommendation. I am using: $Version (* "12.2.0 for Microsoft Windows (64-bit) (December 12, 2020)" *) A possible workaround is to use Region with the appropriate specification like so: ff = Region[ Style[ImplicitRegion[x^2 + y^3 < 2, {{x, -2, 2}, {y, -2, 2}}], Gray, ...


2

Since currently ElementMeshInterpolation does not support PeriodicInterpolation and Interpolation only support PeriodicInterpolation on rectangular grid. Apart from user21's workaround, I developed a workaround for arbitrary parallel or parallelipiped grid periodic interpolation. The idea is naive, just to pull back points outside region by base vectors. ...


10

You can not really. The fact that Interpolation can do this hinges on the data being structured. In other works what I am going to show next is not easily generally possible for meshes that represent a non rectangullar domain; which is the common case for FEM meshes. You can hack it by using the ExtrapolationHandler option. Needs["NDSolve`FEM`"]...


7

As a workaround you can use the finite element mesh generator: Needs["NDSolve`FEM`"] coordinateList = Tuples[{Range[3], Range[3], Range[3]}]; MeshRegion[ToElementMesh[coordinateList], PlotTheme -> "Lines"]


5

Here is an idea that works in 2D (not sure if it is going to work in 3D) First we generate a mesh with a MeshRefinementFunction f2d = Function[{vertices, area}, Block[{x, y}, {x, y} = Mean[vertices]; If[x > 0 && area > 0.001, True, False]]]; m = ToElementMesh[Disk[], MeshRefinementFunction -> f2d]; Then we extract the boundary mesh from ...


8

In my extended comment to the question MeshRefinementFunction on 2D surfaces embedded in 3D, I showed that MaxCellMeasurecould be applied to 2D surfaces embedded in 3D, but that the MeshRefinementFunction seems to be ignored. A potential workaround is to use the functionality in FEMAddOns to join two boundary meshes meshed at different resolutions. A sample ...


4

This is nothing compared to @Tim Laska's detailed answer above, but I found that a quickfire way of removing the small slivers from the geometry was to use the option MaxCellMeasure -> Infinity while turning the region into a mesh, as such: mr = DiscretizeRegion[regionCones, MaxCellMeasure -> Infinity] giving me This works probably because the ...


3

This works in version 12.2.0: MeshCellCount[ConvexHullMesh[data], 2] 30 ConvexHullMesh[data, MeshCellStyle -> { 1 -> Red}] In earlier versions we get 48 triangles (co-planar triangles are not combined): MeshCellCount[ConvexHullMesh[data], 2] (* version 11.3.0 *) 48 The following method (slightly modified version of this answer) works in both ...


2

Maybe this?: chull = ConvexHullMesh[data]; polys = Cases[Show[chull], _Polygon, Infinity]; coords = First@ Cases[Show@chull, GraphicsComplex[c_, ___] :> c, Infinity]; Graphics3D[ GraphicsComplex[ coords, {EdgeForm[Red], polys} ]] The value of polys is in terms of indices into coords: {Polygon[{{18, 11, 10}, ..., {26, 18, 10, 21}, ..., {2, 1, 3,...


1

Maybe this will do what you want. First we create use ConvexHullMeshto create a BoundaryMeshRegion from your data. From this we then extract the 2-dim primitives, that is the triangles. chm = ConvexHullMesh[data]; triangles = MeshPrimitives[chm, 2]; We now have all the triangles. If I understand you correctly, you want all faces that are composed from more ...


1

As Tim pointed out in the comments, the LineElement is a finite element. If you open the ref page of LineElement and click on the "Details" section, you will find more information. Alternatively you can paste this LineElement#921078465 in your help system.


Top 50 recent answers are included