Let's create a rather dense grid of initial conditions
xlim = 4;
ds = 0.05;
data = Flatten[Table[{i, j}, {i, -xlim, xlim, ds}, {j, -xlim, xlim, ds}], 1];
nic = Length[data]
L0 = ListPlot[data, PlotStyle -> {Blue, PointSize[0.001]}];
Then we define a closed two-dimensional curve
C0 = ContourPlot[x^2/4 + y^2/9 == 1, {x, -5, 5}, {y, -5, 5},
PlotPoints -> 100, ContourStyle -> {Black, Thick}];
d0 = C0[[1, 1]];
S0 = ListPlot[d0, PlotStyle -> {Black, Thick}, Joined -> True];
Here I would like to clarify that in my real case scenario we do not know the analytical expression of the closed curve. We only have a list of points such as d0
.
P0 = Show[{L0, S0}, AspectRatio -> 1]
Now I would like to create a new list data2
which will contain all the points of the initial data
that are inside the closed curve.
I am using version 9.0 in 32bit Win XP.
Any suggestions?
NOTE: This question point-in a polygon test looks very similar. However in my case performance over a large number of points is important.