I have created a plot using the code below
DensityPlot[(E^-(x^2 +
y^2)^2)^2 + ((E^-(x^2 + y^2)^2) (x^2 + y^2) Cos[
2 Pi])^2, {x, -3, 3}, {y, -3, 3}, PlotTheme -> "Minimal",
PlotRange -> All, PlotPoints -> 50, ColorFunction -> "Rainbow"]
To create
I have then separated my plot into n number (50 for this code below) of grids and found the center of each grid with the code (from this answer):
means[n_] := MovingAverage[Subdivide[##, n] & @@ #, 2] &
centers[{nc_, nr_}, {xrange_, yrange_}] :=
Tuples[{means[nc]@xrange, means[nr]@yrange}]
{xrange, yrange} = {{-3, 3}, {-3, 3}};
{nc, nr} = {50, 50};
centers[{nc, nr}, {xrange, yrange}]
If I plot my image using my grids and center points I get
My problem is that I would like to only get the center points of the grids that cover the circular shape.
My attempt
I have tried to initiate some kind of if loop that would be able to only pick out the corresponding co ordinates that are on the circular image from the second piece of the code (reposted below again). However I haven't been able to actually come up with a logical condition for this.
means[n_] := MovingAverage[Subdivide[##, n] & @@ #, 2] &
centers[{nc_, nr_}, {xrange_, yrange_}] :=
Tuples[{means[nc]@xrange, means[nr]@yrange}]
{xrange, yrange} = {{-3, 3}, {-3, 3}};
{nc, nr} = {50, 50};
centers[{nc, nr}, {xrange, yrange}]
Thank you for your help