I have ran this on over 1000 geometries and for each i find the coordinates closest to a 512 point cloud and this is the only geometry where RegionNearest gives Indeterminate instead of a coordinate for 5 specific points.
Does anyone have a clue how i this can can happen or prevent it?
(*definethedata*)​​{pointsTemp,regionLocal}=
;
(*visualizetheproblem,plot2givesthe5pointsthatgivemetrouble*)​​p1=Show[regionLocal,​​ListPointPlot3D[Transpose@{pointsTemp},PlotStyle->PointSize[Large]],​​SphericalRegion->True,ImageSize->300];​​p2=Show[regionLocal,​​ListPointPlot3D[Transpose@{pointsTemp[[{4,145,178,317,368}]]},PlotStyle->PointSize[Large]],​​SphericalRegion->True,ImageSize->300];​​{p1,p2}
Out[]=
5 points in my point cloud give Indeterminate when finding the nearest point on the region.
near=RegionNearest[regionLocal];​​​​near/@pointsTemp[[1;;10]]​​near/@pointsTemp[[{4,145,178,317,368}]]
Out[]=
{{54.6271,79.8945,217.914},{53.717,80.0017,228.54},{54.3457,79.5789,223.376},{Indeterminate,Indeterminate,Indeterminate},{58.8283,85.7725,204.949},{38.585,83.484,221.67},{58.1144,86.1234,191.862},{54.4696,107.495,131.378},{58.6873,86.8989,211.465},{28.868,96.729,294.502}}
Out[]=
{{Indeterminate,Indeterminate,Indeterminate},{Indeterminate,Indeterminate,Indeterminate},{Indeterminate,Indeterminate,Indeterminate},{Indeterminate,Indeterminate,Indeterminate},{Indeterminate,Indeterminate,Indeterminate}}
Shifting the points fixes it for some
In[]:=
near/@(pointsTemp[[{4,145,178,317,368}]]+1.5)​​near/@(pointsTemp[[{4,145,178,317,368}]]+2)
Out[]=
{{Indeterminate,Indeterminate,Indeterminate},{54.009,105.25,113.47},{Indeterminate,Indeterminate,Indeterminate},{Indeterminate,Indeterminate,Indeterminate},{Indeterminate,Indeterminate,Indeterminate}}
Out[]=
{{Indeterminate,Indeterminate,Indeterminate},{54.5584,105.671,113.982},{53.793,100.155,113.438},{Indeterminate,Indeterminate,Indeterminate},{Indeterminate,Indeterminate,Indeterminate}}