document.write( "Question 880765: I'm sorry if this is not the right category but I'm not sure where to put this.
\n" );
document.write( "I need to use this for an AI I'm currently programming and I can't find the right algoritm for this.\r
\n" );
document.write( "\n" );
document.write( "The situation:
\n" );
document.write( "I got a collection of points in a coordinate system.
\n" );
document.write( "The size of the collection is unknown , but usually between 1 and 20.
\n" );
document.write( "The location of the points is completely random.\r
\n" );
document.write( "\n" );
document.write( "The desired outcome:
\n" );
document.write( "place a new point X so that as many points of the collection as possible are in a given radius of X\r
\n" );
document.write( "\n" );
document.write( "I'd like to give some images to explain it further but I don't know how on this website.
\n" );
document.write( "I hope I was clear and I'd be really happy if someone could help me.\r
\n" );
document.write( "
\n" );
document.write( "\n" );
document.write( " \n" );
document.write( "
Algebra.Com's Answer #531737 by rothauserc(4718)![]() ![]() You can put this solution on YOUR website! If your coordinate system is the Cartesian coordinate system, then you can calculate the euclidean distance from X to each point(p), namely \n" ); document.write( "d = square root ((x1 -px1)^2 + (y1 -py1)^2) where X = (x1, y1) and any point in the set of 20 elements is (px1, py1) \n" ); document.write( "first sort the points on their x coordinates, then subtract the highest x value from the lowest x value and divide by 2, this gives you the x1 value, do the same for the y values so you get the y1 value \n" ); document.write( "estimate the radius by adding x1 and y1 and divide by 2 \n" ); document.write( "then check that the distance is < or = the estimated radius for each point \n" ); document.write( "accept if it is and reject if it is not\r \n" ); document.write( "\n" ); document.write( " \n" ); document.write( " |