Hi,
I’m testing a very large number of points if they are within a circle. This process is taking 18029 s using the point.IsWithin(BaseShape shape) extension.
I decided to make my own Pythagoras method as follows which runs through the same number of points in 4 s. Any idea why the slowness? NB: I also tried to reverse the test using IsDisjointed with similar results.
private static bool PointInCircle2(PointShape point, EllipseShape circle, double radius)
{
double dx = point.X - circle.Center.X;
double dy = point.Y - circle.Center.Y;
double side = dx * dx + dy * dy;
if (side < radius * radius)
return true;
else
return false;
}
Thanks,
Damian