44 float distance_1, distance_2;
50 int32_t max_samples = (count * count - count) / 2;
54 }
else if (count >= max_samples) {
60 for (i = 0; i < count; i++) {
61 for (j = i + 1; j < count; j++) {
63 dx = (float)vectors[i].pos.x - (
float)vectors[j].
pos.
x;
64 dy = (float)vectors[i].pos.y - (
float)vectors[j].
pos.
y;
65 distance_1 = sqrtf(dx * dx + dy * dy);
67 if (distance_1 < 1
E-5) {
72 dx = (float)vectors[i].pos.x + (
float)vectors[i].
flow_x - (float)vectors[j].pos.x - (
float)vectors[j].
flow_x;
73 dy = (float)vectors[i].pos.y + (
float)vectors[i].
flow_y - (float)vectors[j].pos.y - (
float)vectors[j].
flow_y;
74 distance_2 = sqrtf(dx * dx + dy * dy);
76 divs_sum += (distance_2 - distance_1) / distance_1;
92 dx = (float)vectors[i].pos.x - (
float)vectors[j].
pos.
x;
93 dy = (float)vectors[i].pos.y - (
float)vectors[j].
pos.
y;
94 distance_1 = sqrtf(dx * dx + dy * dy);
96 if (distance_1 < 1
E-5) {
101 dx = (float)vectors[i].pos.x + (
float)vectors[i].
flow_x - (float)vectors[j].pos.x - (
float)vectors[j].
flow_x;
102 dy = (float)vectors[i].pos.y + (
float)vectors[i].
flow_y - (float)vectors[j].pos.y - (
float)vectors[j].
flow_y;
103 distance_2 = sqrtf(dx * dx + dy * dy);
105 divs_sum += (distance_2 - distance_1) / distance_1;
110 if (used_samples < 1){
115 return divs_sum / used_samples;