# obtain the analytics region from mesh or vtk file

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

• Your Sphere.vtk file doesn't contain any inequalities or expressions. They are all points and cells. If you want the equation for this sphere, you need to perform a fit to find parameters of a sphere equation. – flinty Jul 27 '20 at 12:10
• You do sphere = Import["Sphere.vtk"]; mesh = DiscretizeGraphics@sphere; coords = MeshCoordinates[mesh]; Then have a look at ListPointPlot3D[coords, BoxRatios -> 1] You only need the radius since it's clearly centered at zero. The radius is Max[Norm /@ coords] which returns 1. So your sphere is best fit by Sphere[{0,0,0},1] - or better Ball[{0,0,0},1] since points can appear on the inside. – flinty Jul 27 '20 at 12:17
• Thank you very much, do you know if there is any function in Mathematica that looks for the equation of the surface of the sphere ?, from the numerical data – F.Mark Jul 27 '20 at 13:55
• No - just get the points on the shell with pts=MeshCoordinates[ConvexHullMesh[coords]] then assuming a uniform distribution of points, c=Mean[pts] will get the center, and Max[Norm[#-c]&/@pts] will get you the radius. – flinty Jul 27 '20 at 14:16
• Get the faces with MeshPrimitives[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 a ConvexHullMesh first. – flinty Jul 27 '20 at 17:37