0
|
873 Views
|
|
0 Total Likes
View groups...
Share
GROUPS:

# Use of RegionFunction produces weird result

Posted 5 months ago
 Use of RegionFunction produces weird result
 ListPlot3D meshes the domain, after filtering out points at which the function is not numeric (for instance, None in your example). The mesh it forms is the convex hull of the points. Then RegionFunction trims the domain according to which points are in the domain (cuts the surface between those for which rf[] returns True at one point and False at an adjacent one). All the points in the domain (= points for which the 3rd coordinate is a number) are in the region. So RegionFunction effectively changes nothing.This works for me — it might for you — to extend the domain outside the region, so that RegionFunction will cut the surface near the boundary of the region. The boundary may be a little ragged due to the discrete points in record. nf = Nearest[#[[All, 1 ;; 2]] -> #[[All, 3]]] &@ Select[record, FreeQ[None]]; plot = ListPlot3D[record /. {x_, y_, None} :> {x, y, First@nf[{x, y}]}, Mesh -> All] You also might be able to use the FEM functionality to create a mesh that has exactly the points and shape you want. Or one could filter out the unwanted triangles from DelaunayMesh[Select[record, FreeQ[None]][[All, 1 ;; 2]]] inp[coords_, Polygon[idcs_]] := (* using OP's in on midpoints of edges *) With[{xy = coords[[idcs]]}, AllTrue[(xy + RotateLeft@xy)/2, in]]; emesh = ToElementMesh["Coordinates" -> MeshCoordinates[dmesh], "MeshElements" -> {TriangleElement @@ Thread[Select[MeshCells[dmesh, 2], inp[MeshCoordinates[dmesh], #] &], Polygon]}]; eIFN = NDSolveFEMElementMeshInterpolation[{emesh}, Select[record, FreeQ[None]][[All, 3]]]; Plot3D[eIFN[x, y], {x, y} \[Element] emesh]