I'm looking for ideas to develop a method in Java to calculate the maximum number of points in a plane that can communicate as long distance they can and be represented by "D" each one of the points are considered as an object with two coordinates, "X" and "Y" represented as 2 int.
I found that if I select any of this points in the plane, is possible determinate the radius "D" of the circle around the point selected, where all of the mid points contained inside of this radius can communicate with the target point.
My question: Exist a better way to do it in Java?
If you have any suggestions or ideas would be very appreciated.
I may not be understanding your question fully but here's my take on how to find all the points that are within D distance from your selected point on a grid.
There's probably a faster method but here's what I thought of off the top of my head. The basic brute force method would be to go to every point and use the distance formula to check if it can communicate with your selected point. You can improve on this by limiting which points you need to check.
If your selected point is (10, 10) and D = 5, there's no reason to check points such as (0, 0) since it's obviously too far. So you can limit the points you check in a simple square with side length D*2.
For example, if your selected point is (10, 10) and D = 5, every potential communicable point is within the square with corners (5, 5), (5, 15), (15, 5), (15, 5).