# Deleting list points that are in a certain 3D region

Hello I have a large number of data points, from which I want to remove these(between the red lines) that seem to fall onto one plane, what would be the best and easiest approach.

Also added the saved data points : CenterHill.txt

The help is appreciated, thank you. • So actually your two red lines are two planes. Could find their equations? – Αλέξανδρος Ζεγγ Aug 9 '18 at 7:31

The plane seems to have no slope along the x-axis, and the y slope and z translation can easily be found just by guessing and plotting:

Show[ListPointPlot3D[data], Plot3D[3.69 + (y - 24.4) 1.6,
{x, Sequence @@ MinMax[data[[All, 1]]]}, {y, Sequence @@ MinMax[data[[All, 2]]]}]] Signed distances to the plane:

pointOnPlane = {0, 0, 3.69 + (0 - 24.4) 1.6};
normal = Coefficient[3.69 + (y - 24.4) 1.6 - z, #] & /@ {x, y, z};
dists = With[{proj = Projection[# - pointOnPlane, normal]},
Norm[proj] Sign[proj.normal]] & /@ data;


Guess (or maybe use something like Sort[Differences[Sort[dists]]][[-1]]/2) some appropriate threshold to seperate the points near the plane from the rest:

types = Values[PositionIndex[Sign[Threshold[dists, 0.04]]]];

Show[
ListPointPlot3D[data[[types[]]], PlotStyle -> Directive[AbsolutePointSize, Black], PlotRange -> All],
ListPointPlot3D[data[[types[]]], PlotStyle -> Directive[AbsolutePointSize, Red], PlotRange -> All],
ListPointPlot3D[data[[types[]]], PlotStyle -> Directive[AbsolutePointSize, Green], PlotRange -> All],
PlotRange -> All] • Thank you.Got rid of the points by using nData=data For[i = 1, i < Length[data[[types[]]]] + 1, i++, nData= DeleteCases[nData, data[[types[]]][[i]]]] ListPointPlot3D[nData] – Cadis Rai Aug 9 '18 at 8:49