5 void quicksort(
double *array,
int begin,
int end);
11 double theta_from_u[laser_ref->
nrays];
14 for(j=0;j<laser_ref->
nrays;j++) {
21 sm_debug(
"\tvisibility: Found outliers: ");
23 for(j=1;j<laser_ref->
nrays;j++) {
25 if(theta_from_u[j]<theta_from_u[j-1]) {
26 laser_ref->
valid[j] = 0;
48 double dist2_i[laser_sens->
nrays];
49 double dist2_j[laser_ref->
nrays];
50 int j;
for(j=0;j<laser_ref->
nrays;j++)
54 for(i=0;i<laser_sens->
nrays;i++) {
56 int j1 = laser_sens->
corr[i].
j1;
58 dist2_j[j1] = GSL_MIN(dist2_j[j1], dist2_i[i]);
62 for(i=0;i<laser_sens->
nrays;i++) {
64 int j1 = laser_sens->
corr[i].
j1;
65 if(dist2_i[i] > (threshold*threshold)*dist2_j[j1]) {
70 sm_debug(
"\tkill_outliers_double: killed %d correspondences\n",nkilled);
92 double dist2[laser_sens->
nrays];
95 double dist[laser_sens->
nrays];
97 for(i=0;i<laser_sens->
nrays;i++) {
100 double *p_i_w = laser_sens->
points_w[i].
p;
102 int j1 = laser_sens->
corr[i].
j1;
103 int j2 = laser_sens->
corr[i].
j2;
117 double dist2_copy[k];
for(i=0;i<k;i++) dist2_copy[i] = dist2[i];
122 int order = (int)floor(k*(
params->outliers_maxPerc));
123 order = GSL_MAX(0, GSL_MIN(order, k-1));
128 double error_limit1 = dist2[order];
133 int order2 = (int)floor(k*
params->outliers_adaptive_order);
134 order2 = GSL_MAX(0, GSL_MIN(order2, k-1));
135 double error_limit2 =
params->outliers_adaptive_mult*dist2[order2];
137 double error_limit = GSL_MIN(error_limit1, error_limit2);
141 double error_limit2_ho = error_limit2;
142 if((error_limit1_ho != error_limit1) || (error_limit2_ho != error_limit2)) {
143 printf(
"%f == %f %f == %f\n",
144 error_limit1_ho, error_limit1, error_limit2_ho, error_limit2);
153 sm_debug(
"\ticp_outliers: maxPerc %f error_limit: fix %f adaptive %f \n",
154 params->outliers_maxPerc,error_limit1,error_limit2);
158 for(i=0;i<laser_sens->
nrays;i++) {
160 if(dist[i] > error_limit) {
162 laser_sens->
corr[i].
j1 = -1;
163 laser_sens->
corr[i].
j2 = -1;
166 *total_error += dist[i];
170 sm_debug(
"\ticp_outliers: valid %d/%d (limit: %f) mean error = %f \n",nvalid,k,error_limit,
171 *total_error/nvalid);
182 double t = *a; *a = *b; *b=t;
188 double pivot = array[begin];
192 if (array[l] < pivot) {
211 int pivotIndex, i, j;
212 float pivotValue, tmp;
216 pivotIndex = start + (end-start)/2;
217 pivotValue = data[pivotIndex];
222 while(data[i] < pivotValue)
224 while(data[j] > pivotValue)