1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
|
#include <stdio.h>
#include "closestpair.h"
int main(void)
{
Point2D points[] = {
{.x = -5.f, .y = 6.f},
{.x = -3.f, .y = 2.f},
{.x = -1.f, .y = 3.f},
{.x = 0.0f, .y = 0.7f},
{.x = 0.0f, .y = 3.f},
{.x = 0.0f, .y = 0.6f},
{.x = 1.f, .y = 3.f},
{.x = 4.f, .y = 5.f},
};
Point2D points_[] = {
{.x = 0.0f, .y = 0.6f},
{.x = 0.0f, .y = 0.7f},
{.x = -3.f, .y = 2.f},
{.x = 1.f, .y = 3.f},
{.x = 0.f, .y = 3.f},
{.x = -1.f, .y = 3.f},
{.x = 4.f, .y = 5.f},
{.x = -5.f, .y = 6.f},
};
printf("%.3f is closest distance\n", closest_pair(points, points_,0,sizeof(points)/sizeof(points[0])));
return 0;
}
|