Is it possible to obtain the region inequalities from a mesh file (vtk-file).
On gmsh I build a Sphere, and with Mathematica I would like to obtain the analytics region function, that's is possible?.
I can obtain the vertex from the file sphere.vtk, using that:
data = Import["mesh_2_5.vtk", "VertexData"];
But I do not know if exists a routine for obtaining the analytics equations that define this structure. The sphere.vtk can be downloaded from: https://gofile.io/d/OscWUA
thanks
sphere = Import["Sphere.vtk"]; mesh = DiscretizeGraphics@sphere; coords = MeshCoordinates[mesh];
Then have a look atListPointPlot3D[coords, BoxRatios -> 1]
You only need the radius since it's clearly centered at zero. The radius isMax[Norm /@ coords]
which returns 1. So your sphere is best fit bySphere[{0,0,0},1]
- or betterBall[{0,0,0},1]
since points can appear on the inside. $\endgroup$ – flinty Jul 27 '20 at 12:17pts=MeshCoordinates[ConvexHullMesh[coords]]
then assuming a uniform distribution of points,c=Mean[pts]
will get the center, andMax[Norm[#-c]&/@pts]
will get you the radius. $\endgroup$ – flinty Jul 27 '20 at 14:16MeshPrimitives[mesh, 2]
and calculate their normals and a random point on the surface. This should be enough to set up a system of inequalities provided the normals point out of the object. But your sphere is problematic because you have self intersecting geometry and faces internal to the sphere. If your objects are convex, you could treat this with aConvexHullMesh
first. $\endgroup$ – flinty Jul 27 '20 at 17:37